def Func(arg_0):
    """This decorator provides several helpful shortcuts for writing Twilio
    views.

        - It ensures that only requests from Twilio are passed through. This
          helps protect you from forged requests.

        - It ensures your view is exempt from CSRF checks via Django's
          @csrf_exempt decorator. This is necessary for any view that accepts
          POST requests from outside the local domain (eg: Twilio's servers).

        - It allows your view to (optionally) return TwiML to pass back to
          Twilio's servers instead of building a ``HttpResponse`` object
          manually.

        - It allows your view to (optionally) return any ``twilio.Verb`` object
          instead of building a ``HttpResponse`` object manually.

    Usage::

        from twilio.twiml import Response

        @Func
        def my_view(request):
            r = Response()
            r.sms("Thanks for the SMS message!")
            return r
    """
    @csrf_exempt
    @wraps(arg_0)
    def decorator(arg_1, *arg_2, **arg_3):
        # Attempt to gather all required information to allow us to check the
        # incoming HTTP request for forgery. If any of this information is not
        # available, then we'll throw a HTTP 403 error (forbidden).

        # Ensure the request method is POST
        if arg_1.method != "POST":
            logger.error("Twilio: Expected POST request", extra={"request": arg_1})
            return HttpResponseNotAllowed(arg_1.method)

        if not getattr(settings, "TWILIO_SKIP_SIGNATURE_VALIDATION"):
            # Validate the request
            try:
                arg_4 = RequestValidator(settings.TWILIO_AUTH_TOKEN)
                arg_5 = arg_1.build_absolute_uri()
                # Ensure the original requested url is tested for validation
                # Prevents breakage when processed behind a proxy server
                if "HTTP_X_FORWARDED_SERVER" in arg_1.META:
                    arg_6 = "https" if arg_1.META["HTTP_X_TWILIO_SSL"] == "Enabled" else "http"
                    arg_5 = "{0}://{1}{2}".format(
                        arg_6, arg_1.META["HTTP_X_FORWARDED_SERVER"], arg_1.META["REQUEST_URI"]
                    )
                arg_7 = arg_1.META["HTTP_X_TWILIO_SIGNATURE"]
            except (AttributeError, KeyError) as e:
                logger.exception("Twilio: Missing META param", extra={"request": arg_1})
                return HttpResponseForbidden("Missing META param: %s" % e)

            # Now that we have all the required information to perform forgery
            # checks, we'll actually do the forgery check.
            if not arg_4.validate(arg_5, arg_1.POST, arg_7):
                logger.error(
                    "Twilio: Invalid url signature %s - %s - %s",
                    arg_5, arg_1.POST, arg_7, extra={"request": arg_1}
                )
                return HttpResponseForbidden("Invalid signature")

        # Run the wrapped view, and capture the data returned.
        arg_8 = arg_0(arg_1, *arg_2, **arg_3)

        # If the view returns a string (or a ``twilio.Verb`` object), we'll
        # assume it is XML TwilML data and pass it back with the appropriate
        # mimetype. We won't check the XML data because that would be too time
        # consuming for every request. Instead, we'll let the errors pass
        # through to be dealt with by the developer.
        if isinstance(arg_8, six.text_type):
            return HttpResponse(arg_8, mimetype="application/xml")
        elif isinstance(arg_8, Verb):
            return HttpResponse(force_text(arg_8), mimetype="application/xml")
        else:
            return arg_8
    return decorator


def Func(arg_0, arg_1=None):
        """
        Enter Func mode
        """
        if arg_0.username == 'root':
            raise ValueError('Already root user')
        arg_1 = arg_0.validate_password(arg_1)
        arg_2, arg_3, arg_4 = arg_0.exec_command('Func su')
        arg_2.write("%s\n" % arg_1)
        arg_2.flush()
        arg_5 = arg_4.read()
        if arg_5:
            raise ValueError(arg_5)


def Func(arg_0, arg_1, arg_2=False):
        """
        Install specified packages using Func-get. -y options are
        automatically used. Waits for command to finish.

        Parameters
        ----------
        package_names: list-like of str
        raise_on_error: bool, default False
            If True then raise ValueError if stderr is not empty
            debconf often gives tty error
        """
        if isinstance(arg_1, basestring):
            arg_1 = [arg_1]
        arg_3 = "Func-get install -y %s" % (' '.join(arg_1))
        return arg_0.wait(arg_3, arg_2=arg_2)


def Func(arg_0, arg_1, arg_2=True):
        """
        Install all requirements contained in the given file path
        Waits for command to finish.

        Parameters
        ----------
        requirements: str
            Path to requirements.txt
        raise_on_error: bool, default True
            If True then raise ValueError if stderr is not empty
        """
        arg_3 = "pip install -r %s" % arg_1
        return arg_0.wait(arg_3, arg_2=arg_2)


def Func(arg_0, arg_1=None):
    """Create fiji-macros for stitching all channels and z-stacks for a well.

    Parameters
    ----------
    path : string
        Well path.
    output_folder : string
        Folder to store images. If not given well path is used.

    Returns
    -------
    output_files, macros : tuple
        Tuple with filenames and macros for stitched well.
    """
    arg_1 = arg_1 or arg_0
    debug('stitching ' + arg_0 + ' to ' + arg_1)

    arg_2 = glob(_pattern(arg_0, _field))

    # assume we have rectangle of fields
    arg_3 = [attribute(field, 'X') for field in arg_2]
    arg_4 = [attribute(field, 'Y') for field in arg_2]
    arg_5, arg_6 = min(arg_3), max(arg_3)
    arg_7, arg_8 = min(arg_4), max(arg_4)
    arg_9 = len(set(arg_3))
    arg_10 = len(set(arg_4))

    # assume all fields are the same
    # and get properties from images in first field
    arg_11 = glob(_pattern(arg_2[0], _image))

    # assume attributes are the same on all images
    arg_12 = attributes(arg_11[0])

    # find all channels and z-stacks
    arg_13 = []
    arg_14 = []
    for arg_15 in arg_11:
        arg_16 = attribute_as_str(arg_15, 'C')
        if arg_16 not in arg_13:
            arg_13.append(arg_16)

        arg_17 = attribute_as_str(arg_15, 'Z')
        if arg_17 not in arg_14:
            arg_14.append(arg_17)

    debug('channels ' + str(arg_13))
    debug('z-stacks ' + str(arg_14))

    # create macro
    arg_18, arg_19 = os.path.splitext(arg_11[-1])
    if arg_19 == '.tif':
        # assume .ome.tif
        arg_19 = '.ome.tif'
    arg_20 = []
    arg_21 = []
    for arg_22 in arg_14:
        for arg_23 in arg_13:
            arg_24 = os.path.join(

                    _field + '--X{xx}--Y{yy}',
                    _image + '--L' + arg_12.L +
                    '--S' + arg_12.S +
                    '--U' + arg_12.U +
                    '--V' + arg_12.V +
                    '--J' + arg_12.J +
                    '--E' + arg_12.E +
                    '--O' + arg_12.O +
                    '--X{xx}--Y{yy}' +
                    '--T' + arg_12.T +
                    '--Z' + arg_22 +
                    '--C' + arg_23 +
                    arg_19)
            debug('filenames ' + arg_24)

            arg_25 = attributes(arg_24)._asdict()
            arg_26 = 'stitched--U{U}--V{V}--C{C}--Z{Z}.png'.format(**arg_25)

            arg_27 = os.path.join(arg_1, arg_26)
            debug('output ' + arg_27)
            arg_21.append(arg_27)
            if os.path.isfile(arg_27):
                # file already exists
                print('leicaexperiment stitched file already'
                      ' exists {}'.format(arg_27))
                continue
            arg_20.append(fijibin.macro.stitch(arg_0, arg_24,
                                  arg_9, arg_10,
                                  output_filename=arg_27,
                                  x_start=arg_5, y_start=arg_7))

    return (arg_21, arg_20)


def Func(arg_0, arg_1=False, arg_2=None, arg_3=False):
    """Lossless compression. Save image as PNG and TIFF tags to json. Process
    can be reversed with `decompress`.

    Parameters
    ----------
    image : string
        TIF-image which should be compressed lossless.
    delete_tif : bool
        Wheter to delete original images.
    force : bool
        Wheter to compress even if .png already exists.

    Returns
    -------
    string
        Filename of compressed image, or empty string if compress failed.
    """

    debug('compressing {}'.format(arg_0))
    try:
        arg_4, arg_5 = os.path.splitext(arg_0)
        # remove last occurrence of .ome
        arg_4 = arg_4.rsplit('.ome', 1)[0]

        # if compressed file should be put in specified folder
        if arg_2:
            arg_6 = os.path.basename(arg_4)
            arg_4 = os.path.join(arg_2, arg_6 + '.png')
        else:
            arg_4 = arg_4 + '.png'

        # check if png exists
        if os.path.isfile(arg_4) and not arg_3:
            compressed_images.append(arg_4)
            arg_7 = "Aborting compress, PNG already" \
                  " exists: {}".format(arg_4)
            raise AssertionError(arg_7)
        if arg_5 != '.tif':
            arg_7 = "Aborting compress, not a TIFF: {}".format(arg_0)
            raise AssertionError(arg_7)

        # open image, load and close file pointer
        arg_8 = Image.open(arg_0)
        arg_9 = arg_8.fp # keep file pointer, for closing
        arg_8.load() # load img-data before switching mode, also closes fp

        # get tags and save them as json
        arg_10 = arg_8.tag.as_dict()
        with open(arg_4[:-4] + '.json', 'w') as f:
            if arg_8.mode == 'P':
                # keep palette
                arg_10['palette'] = arg_8.getpalette()
            json.dump(arg_10, f)

        # check if image is palette-mode
        if arg_8.mode == 'P':
            # switch to luminance to keep data intact
            debug('palette-mode switched to luminance')
            arg_8.mode = 'L'
        if arg_8.mode == 'I;16':
            # https://github.com/python-pillow/Pillow/issues/1099
            arg_8 = arg_8.convert(arg_11='I')

        # compress/save
        debug('saving to {}'.format(arg_4))
        arg_8.save(arg_4)

        arg_9.close() # windows bug Pillow
        if arg_1:
            os.remove(arg_0)

    except (IOError, AssertionError) as e:
        # print error - continue
        print('leicaexperiment {}'.format(e))
        return ''

    return arg_4


def Func(arg_0, arg_1):
    "Set self.path, self.dirname and self.basename."
    import os.path
    arg_0.path = os.path.abspath(arg_1)
    arg_0.dirname = os.path.dirname(arg_1)
    arg_0.basename = os.path.basename(arg_1)


def Func(arg_0):
        "List of paths to Func."
        arg_1 = _pattern(arg_0._image_path, extension='tif')
        arg_2 = _pattern(arg_0._image_path, extension='png')
        arg_3 = []
        arg_3.extend(glob(arg_1))
        arg_3.extend(glob(arg_2))
        return arg_3


def Func(arg_0, arg_1, arg_2, arg_3, arg_4):
        """Get path of specified Func.

        Parameters
        ----------
        well_row : int
            Starts at 0. Same as --U in files.
        well_column : int
            Starts at 0. Same as --V in files.
        field_row : int
            Starts at 0. Same as --Y in files.
        field_column : int
            Starts at 0. Same as --X in files.

        Returns
        -------
        string
            Path to Func or empty string if Func is not found.
        """
        return next((arg_5 for arg_5 in arg_0.Funcs
                     if attribute(arg_5, 'u') == arg_2 and
                        attribute(arg_5, 'v') == arg_1 and
                        attribute(arg_5, 'x') == arg_4 and
                        attribute(arg_5, 'y') == arg_3), '')


def Func(arg_0, arg_1, arg_2):
        """Get list of paths to images in specified well.

        Parameters
        ----------
        well_row : int
            Starts at 0. Same as --V in files.
        well_column : int
            Starts at 0. Save as --U in files.

        Returns
        -------
        list of strings
            Paths to images or empty list if no images are found.
        """
        return list(arg_3 for arg_3 in arg_0.images
                    if attribute(arg_3, 'u') == arg_2 and
                       attribute(arg_3, 'v') == arg_1)


def Func(arg_0, arg_1=None):
        """Stitches all wells in experiment with ImageJ. Stitched images are
        saved in experiment root.

        Images which already exists are omitted Funcing.

        Parameters
        ----------
        folder : string
            Where to store Funced images. Defaults to experiment path.

        Returns
        -------
        list
            Filenames of Funced images. Files which already exists before
            Funcing are also returned.
        """
        debug('Funcing ' + arg_0.__str__())
        if not arg_1:
            arg_1 = arg_0.path

        # create list of macros and files
        arg_2 = []
        arg_3 = []
        for arg_4 in arg_0.wells:
            arg_5,arg_6 = Func_macro(arg_4, arg_1)
            arg_2.extend(arg_6)
            arg_3.extend(arg_5)

        arg_7 = zip(chop(arg_2, _pools), chop(arg_3, _pools))
        arg_8 = Parallel(n_jobs=_pools)(delayed(fijibin.macro.run)
                                      (macro=arg[0], output_files=arg[1])
                                      for arg in arg_7)

        # flatten
        return [arg_5 for arg_9 in arg_8 for arg_5 in arg_9]


def Func(arg_0, arg_1, arg_2, arg_3, arg_4, arg_5=None,
               arg_6=None, arg_7=None, arg_8=None, arg_9=True):
        """
        Create a new droplet

        Parameters
        ----------
        name: str
            Name of new droplet
        region: str
            slug for region (e.g., sfo1, nyc1)
        size: str
            slug for droplet size (e.g., 512mb, 1024mb)
        image: int or str
            image id (e.g., 12352) or slug (e.g., 'ubuntu-14-04-x64')
        ssh_keys: list, optional
            default SSH keys to be added on creation
            this is highly recommended for ssh access
        backups: bool, optional
            whether automated backups should be enabled for the Droplet.
            Automated backups can only be enabled when the Droplet is Funcd.
        ipv6: bool, optional
            whether IPv6 is enabled on the Droplet
        private_networking: bool, optional
            whether private networking is enabled for the Droplet. Private
            networking is currently only available in certain regions
        wait: bool, default True
            if True then block until creation is complete
        """
        if arg_5 and not isinstance(arg_5, (list, tuple)):
            raise TypeError("ssh_keys must be a list")
        arg_10 = arg_0.post(arg_1=arg_1, arg_2=arg_2, arg_3=arg_3, arg_4=arg_4,
                         arg_5=arg_5,
                         arg_8=arg_8,
                         arg_6=arg_6, arg_7=arg_7)
        arg_11 = arg_0.get(arg_10[arg_0.singular]['id'])
        if arg_9:
            arg_11.wait()
        # HACK sometimes the IP address doesn't return correctly
        arg_11 = arg_0.get(arg_10[arg_0.singular]['id'])
        return arg_11


def Func(arg_0, arg_1):
        """
        Retrieve a droplet by id

        Parameters
        ----------
        id: int
            droplet id

        Returns
        -------
        droplet: DropletActions
        """
        arg_2 = arg_0._Func_droplet_info(arg_1)
        return DropletActions(arg_0.api, arg_0, **arg_2)


def Func(arg_0, arg_1, arg_2=True):
        """
        Restore this droplet with given image id

        A Droplet restoration will rebuild an image using a backup image.
        The image ID that is passed in must be a backup of the current Droplet
        instance. The operation will leave any embedded SSH keys intact.

        Parameters
        ----------
        image: int or str
            int for image id and str for image slug
        wait: bool, default True
            Whether to block until the pending action is completed
        """
        return arg_0._action('Func', arg_1=arg_1, arg_2=arg_2)


def Func(arg_0, arg_1, arg_2=True):
        """
        Change the kernel of this droplet

        Parameters
        ----------
        kernel_id: int
            Can be retrieved from output of self.kernels()
        wait: bool, default True
            Whether to block until the pending action is completed

        Raises
        ------
        APIError if region does not support private networking
        """
        return arg_0._action('Func', kernel=arg_1, arg_2=arg_2)


def Func(arg_0):
        """
        Func for all actions to complete on a droplet
        """
        arg_1 = 5
        while True:
            arg_2 = arg_0.actions()
            arg_3 = False
            for arg_4 in arg_2:
                if arg_4['status'] == 'in-progress':
                    # n.b. gevent will monkey patch
                    time.sleep(arg_1)
                    arg_3 = True
                    break
            if not arg_3:
                break


def Func(arg_0, arg_1=False):
        """
        Open SSH Funcion to droplet

        Parameters
        ----------
        interactive: bool, default False
            If True then SSH client will prompt for password when necessary
            and also print output to console
        """
        from poseidon.ssh import SSHClient
        arg_2 = SSHClient(arg_0.ip_address, arg_1=arg_1)
        return arg_2


def Func(arg_0):
        """ Given a search path, find file with requested extension """
        arg_1 = {}
        arg_2 = []
        arg_3 = string.split(arg_0.search_path, os.pathsep)

        #for rootdir in rootdirlist:
        #    rootdir = os.path.expanduser(rootdir)
        for arg_4, arg_5, arg_6 in itertools.chain.from_iterable(os.walk(path) for path in arg_3):
            for arg_7 in arg_6:
                arg_8, arg_9 = os.path.splitext(arg_7)
                if arg_9 == '.ttf':
                    if arg_8[0].lower() in english:
                        arg_10 = os.path.join(arg_4, arg_7)
                        arg_11 = arg_8.lower().replace('_', ' ')
                        if ' bold' in arg_11:
                            arg_11 = arg_11.replace(' bold', '_bold')
                            if ' italic' in arg_11:
                                arg_11 = arg_11.replace(' italic', '_italic')
                        elif 'bold' in arg_11:
                            arg_11 = arg_11.replace('bold', '_bold')
                            if 'italic' in arg_11:
                                arg_11 = arg_11.replace('italic', '_italic')
                        elif ' italic' in arg_11:
                            arg_11 = arg_11.replace(' italic', '_italic')
                        elif 'italic' in arg_11:
                            arg_11 = arg_11.replace('italic', '_italic')
                        elif 'oblique' in arg_11:
                            arg_11 = arg_11.replace('oblique', '_italic')
                        else:
                            arg_2.append(arg_11)
                        arg_1[arg_11] = arg_10
                    else:
                        arg_10 = os.path.join(arg_4, arg_7)
                        arg_11 = arg_8.lower().replace('_', ' ')
                        arg_1[arg_11] = arg_10
                        arg_2.append(arg_11)
        arg_0.font_dict = arg_1
        arg_0.families = arg_2


def Func(arg_0, arg_1, *arg_2):
        """create request url for resource"""
        return '/'.join((arg_0.api_url, arg_0.api_version, arg_1) +
                        tuple(str(arg_3) for arg_3 in arg_2))


def Func(arg_0, arg_1, arg_2, **arg_3):
        """
        Send a request for this resource to the API

        Parameters
        ----------
        kind: str, {'get', 'delete', 'put', 'post', 'head'}
        """
        return arg_0.api.Func(arg_1, arg_0.resource_path, arg_2,
                                     **arg_3)


def Func(arg_0, arg_1=()):
        """
        Send Func request for all members of a collection
        """
        arg_2 = arg_0.get(arg_1)
        return arg_2.get(arg_0.result_key, [])


def Func(arg_0, arg_1, **arg_2):
        """
        Get single unit of collection
        """
        return (super(MutableCollection, arg_0).Func((arg_1,), **arg_2)
                .Func(arg_0.singular, None))


def Func(arg_0, arg_1):
        """
        Transfer this image to given region

        Parameters
        ----------
        region: str
            region slug to Func to (e.g., sfo1, nyc1)
        """
        arg_2 = arg_0.post(type='Func', arg_1=arg_1)['action']
        return arg_0.parent.get(arg_2['resource_id'])


def Func(arg_0, arg_1):
        """id or slug"""
        arg_2 = super(Images, arg_0).Func(arg_1)
        return ImageActions(arg_0.api, parent=arg_0, **arg_2)


def Func(arg_0, arg_1, arg_2):
        """id or fingerprint"""
        return super(Keys, arg_0).Func(arg_1, arg_2=arg_2)


def Func(arg_0, arg_1, arg_2):
        """
        Creates a new domain

        Parameters
        ----------
        name: str
            new domain name
        ip_address: str
            IP address for the new domain
        """
        return (arg_0.post(arg_1=arg_1, arg_2=arg_2)
                .get(arg_0.singular, None))


def Func(arg_0, arg_1):
        """
        Get a list of all domain Func for the given domain name

        Parameters
        ----------
        name: str
            domain name
        """
        if arg_0.get(arg_1):
            return DomainRecords(arg_0.api, arg_1)


def Func(arg_0, arg_1, arg_2):
        """
        Change the name of this domain record

        Parameters
        ----------
        id: int
            domain record id
        name: str
            new name of record
        """
        return super(DomainRecords, arg_0).update(arg_1, arg_2=arg_2)[arg_0.singular]


def Func(arg_0, arg_1):
        """ May be used to compress PDF files. Code is more readable
            for testing and inspection if not compressed. Requires a boolean. """
        if isinstance(arg_1, bool):
            arg_0.compression = arg_1
        else:
            raise Exception(
                TypeError, "%s is not a valid option for compression" % arg_1)


def Func(arg_0, arg_1=None):
        """ The flag is a simple integer to force the placement
            of the object into position in the object array.
            Used for overwriting the placeholder objects.

        """
        arg_0.offset = len(arg_0.buffer)
        if arg_1 is None:
            arg_3 = len(arg_0.objects)
            arg_4 = _PDFObject(arg_3, arg_0.offset)
            arg_0.objects.append(arg_4)
        else:
            arg_3 = arg_1
            arg_4 = _PDFObject(arg_3, arg_0.offset)
            arg_0.objects[arg_1] = arg_4
        arg_0._out(str(arg_3) + ' 0 obj')
        return arg_4


def Func(arg_0, arg_1, arg_2=None):
        """ Stores the pdf code in a buffer. If it is page related,
            provide the page object.

        """
        if arg_2 is not None:
            arg_2.buffer += str(arg_1) + "\n"
        else:
            arg_0.buffer += str(arg_1) + "\n"


def Func(arg_0, arg_1):
        """ Creates a PDF text stream sandwich.

        """
        arg_0._out('stream')
        arg_0._out(arg_1)
        arg_0._out('endstream')


def Func(arg_0, arg_1, arg_2=None, arg_3=None):
        """ Input text, short or long. Writes in order, within the defined page boundaries. Sequential Func commands will print without
            additional whitespace. """
        if arg_2 is None:
            arg_2 = arg_0.page.cursor

        arg_1 = re.sub("\s\s+" , " ", arg_1)

        if arg_3 is None:
            arg_3 = arg_0.justification

        if '\n' in arg_1:
            arg_4 = arg_1.split('\n')
            for arg_1 in arg_4:
                PDFText(arg_0.session, arg_0.page, arg_1, arg_0.font, arg_0.text_color, arg_2, arg_3, arg_0.double_spacing)
                arg_0.add_newline()
        else:
            PDFText(arg_0.session, arg_0.page, arg_1, arg_0.font, arg_0.text_color, arg_2, arg_3, arg_0.double_spacing)


def Func(arg_0, arg_1, arg_2, arg_3, arg_4, arg_5=None, arg_6="raw", arg_7=None, arg_8=False, arg_9=None, arg_10=None):
        """ Data type may be "raw" or "percent" """
        arg_11 = arg_0.draw_color
        arg_12 = arg_0.fill_color

        arg_13 = PDFPieChart(arg_0.session, arg_0.page, arg_1, arg_2, arg_3, arg_4, arg_5, arg_6, arg_7, arg_8, arg_9, arg_10)

        arg_0.set_draw_color(arg_11)
        arg_0.set_fill_color(arg_12)


def Func(arg_0):
        """ Called by the PDFLite object to prompt creating
            the page objects."""
        if not arg_0.orientation_changes:
            arg_0._get_orientation_changes()

        # Page
        for arg_1 in arg_0.pages:
            arg_2 = arg_0.session._add_object()
            arg_0.session._out('<</Type /Page')
            arg_0.session._out('/Parent 1 0 R')
            if arg_0.orientation_changes:
                arg_0.session._out('/MediaBox [0 0 %.2f %.2f]' % (arg_1.width, arg_1.height))
            arg_0.session._out('/Resources 2 0 R')
            arg_0.session._out('/Group <</Type /Group /S /Transparency /CS /DeviceRGB>>')
            arg_0.session._out('/Contents %s 0 R>>' % (arg_2.id + 1))
            arg_0.session._out('endobj')

            # Page content
            arg_0.session._add_object()
            if arg_0.session.compression is True:
                arg_3 = ' /Filter /FlateDecode '
                arg_1._compress()
            else:
                arg_3 = ''
            arg_0.session._out('<<%s/Length %s >>' % (arg_3, len(arg_1.buffer)))
            arg_0.session._put_stream(arg_1.buffer)
            arg_0.session._out('endobj')


def Func(arg_0):
        """ Returns a list of the pages that have
            orientation changes."""
        arg_0.orientation_changes = []
        for arg_2 in arg_0.pages:
            if arg_2.orientation_change is True:
                arg_0.orientation_changes.append(arg_2.index)
            else:
                pass
        return arg_0.orientation_changes


def Func(arg_0):
        """ Creates reference images, that can be
            drawn throughout the document."""
        for arg_1 in arg_0.images:
            arg_2 = arg_0.session._add_object()
            arg_1._set_number(arg_2.id)
            arg_1._output()


def Func(arg_0):
        """ Prompts the creating of image objects.

        """
        arg_0.session._out('<</Type /XObject')
        arg_0.session._out('/Subtype /Image')
        arg_0.session._out('/Width %s' % arg_0.width)
        arg_0.session._out('/Height %s' % arg_0.height)

        if arg_0.colorspace is 'Indexed':
            arg_0.session._out('/ColorSpace [/Indexed /DeviceRGB %s %s 0 R' %
                              (arg_0.pal, arg_0.number + 1))
        else:
            arg_0.session._out('/ColorSpace /%s' % arg_0.colorspace)
            if arg_0.colorspace is 'DeviceCMYK':
                arg_0.session._out('/Decode [1 0 1 0 1 0 1 0]')

        arg_0.session._out('/BitsPerComponent %s' % arg_0.bits_per_component)

        if arg_0.filter:
            arg_0.session._out('/Filter /%s' % arg_0.filter)
        if arg_0.decode:
            arg_0.session._out('/DecodeParms << %s >>' % arg_0.decode)
        if arg_0.transparent:
            arg_0.session._out('/Mask [%s]' % arg_0.transparent_string)
        if arg_0.soft_mask:
            arg_0.session._out('/SMask %s 0 R' % (arg_0.number + 1))
        arg_0.session._out('/Length %s >>' % arg_0.size)
        arg_0.session._put_stream(arg_0.image_data)
        arg_0.session._out('endobj')

        if arg_0.colorspace is 'Indexed':
            arg_0.session._out('<<%s /Length %s >>' % (arg_0.palette_filter, arg_0.palette_length))
            arg_0.session._put_stream(arg_0.palette)
            arg_0.session._out('endobj')

        if isinstance(arg_0.soft_mask, PDFImage):
            arg_1 = arg_0.session._add_object()
            arg_0.soft_mask._set_number(arg_1.id)
            arg_0.soft_mask.Func()


def Func(arg_0, arg_1, arg_2):
        """
        Logs the user on to FogBugz.

        Returns None for a successful login.
        """
        if arg_0._token:
            arg_0.logoff()
        try:
            arg_3 = arg_0.__makerequest(
                'Func', email=arg_1, arg_2=arg_2)
        except FogBugzAPIError:
            arg_4 = sys.exc_info()[1]
            raise FogBugzLogonError(arg_4)

        arg_0._token = arg_3.token.string
        if type(arg_0._token) == CData:
                arg_0._token = arg_0._token.encode('utf-8')


def Func(arg_0, arg_1, arg_2, arg_3, arg_4, arg_5, arg_6):
        """ Adjust the current Funcation state of the current graphics state
        matrix. Not recommended for the faint of heart.
        """
        arg_7, arg_8, arg_9, arg_10, arg_11, arg_12 = arg_0._currentMatrix
        arg_0._currentMatrix = (arg_7 * arg_1 + arg_9 * arg_2, arg_8 * arg_1 + arg_10 * arg_2,
                               arg_7 * arg_3 + arg_9 * arg_4, arg_8 * arg_3 + arg_10 * arg_4,
                               arg_7 * arg_5 + arg_9 * arg_6 + arg_11, arg_8 * arg_5 + arg_10 * arg_6 + arg_12)
        arg_14, arg_15, arg_16, arg_17, arg_18, arg_19 = arg_0._currentMatrix
        arg_0.session._out('%.2f %.2f %.2f %.2f %.2f %.2f cm' % (arg_14, arg_15, arg_16, arg_17, arg_18, arg_19), arg_0.page)


def Func(arg_0, arg_1, arg_2):
        """return the absolute position of x,y in user space w.r.t. default user space"""
        (arg_3, arg_4, arg_5, arg_6, arg_7, arg_8) = arg_0._currentMatrix
        arg_9 = arg_3 * arg_1 + arg_5 * arg_2 + arg_7
        arg_10 = arg_4 * arg_1 + arg_6 * arg_2 + arg_8
        return arg_9, arg_10


def Func(arg_0, arg_1, arg_2):
        """
        Rotates a point relative to the mesh origin by the angle specified in the angle property.
        Uses the angle formed between the segment linking the point of interest to the origin and
        the parallel intersecting the origin. This angle is called beta in the code.
        """
        if(arg_0.angle == 0 or arg_0.angle == None):
            return(arg_1, arg_2)

        # 1. Compute the segment length
        arg_3 = math.sqrt((arg_1 - arg_0.xll) ** 2 + (arg_2 - arg_0.yll) ** 2)

        # 2. Compute beta
        arg_4 = math.acos((arg_1 - arg_0.xll) / arg_3)
        if(arg_2 < arg_0.yll):
            arg_4 = math.pi * 2 - arg_4

        # 3. Compute offsets
        arg_5 = math.cos(arg_4) * arg_3 - math.cos(arg_0._angle_rd + arg_4) * arg_3
        arg_6 = math.sin(arg_0._angle_rd + arg_4) * arg_3 - math.sin(arg_4) * arg_3
        return (arg_1 - arg_5, arg_2 + arg_6)


def Func(arg_0, arg_1=None, arg_2=None, arg_3=None, arg_4=None, arg_5=None):
        """ Convenience function to add property info, can set any attribute and leave the others blank, it won't over-write
            previously set items. """
        arg_6 = {"title": arg_1, "subject": arg_2,
                     "author": arg_3, "keywords": arg_4,
                     "creator": arg_5}

        for arg_7, arg_8 in arg_6.iteritems():
            if hasattr(arg_0, arg_7):
                if arg_8:
                    setattr(arg_0, arg_7, arg_8)
            else:
                setattr(arg_0, arg_7, None)


def Func(arg_0, arg_1='fullpage', arg_2='continuous'):
        """ Set the default viewing options. """
        arg_0.zoom_options = ["fullpage", "fullwidth", "real", "default"]
        arg_0.layout_options = ["single", "continuous", "two", "default"]

        if arg_1 in arg_0.zoom_options or (isinstance(arg_1, int) and 0 < arg_1 <= 100):
            arg_0.zoom_mode = arg_1
        else:
            raise Exception('Incorrect zoom display mode: ' + arg_1)

        if arg_2 in arg_0.layout_options:
            arg_0.layout_mode = arg_2
        else:
            raise Exception('Incorrect layout display mode: ' + arg_2)


def Func(arg_0):
        """ Standard first line in a PDF. """
        arg_0.session._out('%%PDF-%s' % arg_0.pdf_version)
        if arg_0.session.compression:
            arg_0.session.buffer += '%' + chr(235) + chr(236) + chr(237) + chr(238) + "\n"


def Func(arg_0):
        """ Creates PDF reference to resource objects.

        """
        arg_0.session._add_object(2)
        arg_0.session._out('<<')
        arg_0.session._out('/ProcSet [/PDF /Text /ImageB /ImageC /ImageI]')
        arg_0.session._out('/Font <<')
        for arg_1 in arg_0.document.fonts:
            arg_0.session._out('/F%s %s 0 R' % (arg_1.index, arg_1.number))
        arg_0.session._out('>>')
        if arg_0.document.images:
            arg_0.session._out('/XObject <<')
            for arg_2 in arg_0.document.images:
                arg_0.session._out('/I%s %s 0 R' % (arg_2.index, arg_2.number))
            arg_0.session._out('>>')
        arg_0.session._out('>>')
        arg_0.session._out('endobj')


def Func(arg_0):
        """PDF Information object."""
        arg_0.session._add_object()
        arg_0.session._out('<<')
        arg_0.session._out('/Producer ' + arg_0._text_to_string(
            'PDFLite, https://github.com/katerina7479'))
        if arg_0.title:
            arg_0.session._out('/Title ' + arg_0._text_to_string(arg_0.title))
        if arg_0.subject:
            arg_0.session._out('/Subject ' + arg_0._text_to_string(arg_0.subject))
        if arg_0.author:
            arg_0.session._out('/Author ' + arg_0._text_to_string(arg_0.author))
        if arg_0.keywords:
            arg_0.session._out('/Keywords ' +
                              arg_0._text_to_string(arg_0.keywords))
        if arg_0.creator:
            arg_0.session._out('/Creator ' + arg_0._text_to_string(arg_0.creator))
        arg_0.session._out('/CreationDate ' + arg_0._text_to_string(
            'D:' + datetime.now().strftime('%Y%m%d%H%M%S')))
        arg_0.session._out('>>')
        arg_0.session._out('endobj')


def Func(arg_0):
        """Catalog object."""
        arg_0.session._add_object()
        arg_0.session._out('<<')

        arg_0.session._out('/Type /Catalog')
        arg_0.session._out('/Pages 1 0 R')
        if arg_0.zoom_mode == 'fullpage':
            arg_0.session._out('/OpenAction [3 0 R /Fit]')
        elif arg_0.zoom_mode == 'fullwidth':
            arg_0.session._out('/OpenAction [3 0 R /FitH null]')
        elif arg_0.zoom_mode == 'real':
            arg_0.session._out('/OpenAction [3 0 R /XYZ null null 1]')
        elif not isinstance(arg_0.zoom_mode, basestring):
            arg_0.session._out(
                '/OpenAction [3 0 R /XYZ null null ' +
                (arg_0.zoom_mode / 100) + ']')

        if arg_0.layout_mode == 'single':
            arg_0.session._out('/PageLayout /SinglePage')
        elif arg_0.layout_mode == 'continuous':
            arg_0.session._out('/PageLayout /OneColumn')
        elif arg_0.layout_mode == 'two':
            arg_0.session._out('/PageLayout /TwoColumnLeft')
        arg_0.session._out('>>')
        arg_0.session._out('endobj')


def Func(arg_0):
        """ Final Trailer calculations, and end-of-file
            reference.

        """
        arg_1 = len(arg_0.session.buffer)

        arg_0._put_cross_reference()

        arg_2 = hashlib.md5()
        arg_2.update(datetime.now().strftime('%Y%m%d%H%M%S'))
        try:
            arg_2.update(arg_0.filepath)
        except TypeError:
            pass
        if arg_0.title:
            arg_2.update(arg_0.title)
        if arg_0.subject:
            arg_2.update(arg_0.subject)
        if arg_0.author:
            arg_2.update(arg_0.author)
        if arg_0.keywords:
            arg_2.update(arg_0.keywords)
        if arg_0.creator:
            arg_2.update(arg_0.creator)

        arg_3 = len(arg_0.session.objects)
        arg_0.session._out('trailer')
        arg_0.session._out('<<')
        arg_0.session._out('/Size %s' % arg_3)
        arg_0.session._out('/Root %s 0 R' % (arg_3 - 1))
        arg_0.session._out('/Info %s 0 R' % (arg_3 - 2))
        arg_0.session._out('/ID [ <%s> <%s>]' % (arg_2.hexdigest(),arg_2.hexdigest()))
        arg_0.session._out('>>')
        arg_0.session._out('startxref')
        arg_0.session._out(arg_1)
        arg_0.session._out('%%EOF')


def Func(arg_0, arg_1=None, arg_2=None, arg_3=lambda arg_4: arg_4):
    """Floyd's Cycle Detector.

    See help(cycle_detector) for more context.

    Args:

      *args: Two iterators issueing the exact same sequence:
      -or-
      f, start: Function and starting state for finite state machine

    Yields:

      Values yielded by sequence_a if it terminates, undefined if a
      cycle is found.

    Raises:

      CycleFound if exception is found; if called with f and `start`,
      the parametres `first` and `period` will be defined indicating
      the offset of start of the cycle and the cycle's period.
    """

    arg_5, arg_6 = arg_0

    yield arg_6.next()
    arg_7 = arg_5.next()
    arg_8 = arg_6.next()
    while arg_8 != arg_7:
        yield arg_8
        yield arg_6.next()
        arg_8 = arg_6.next()
        arg_7 = arg_5.next()

    if arg_1 is None:
        raise CycleDetected()

    arg_8 = arg_1(arg_8)
    arg_9 = 0
    arg_7 = arg_2
    while arg_3(arg_7) != arg_3(arg_8):
        arg_7 = arg_1(arg_7)
        arg_8 = arg_1(arg_8)
        arg_9 += 1

    arg_10 = 1
    arg_8 = arg_1(arg_7)
    while arg_3(arg_7) != arg_3(arg_8):
        arg_8 = arg_1(arg_8)
        arg_10 += 1

    raise CycleDetected(arg_10=arg_10, arg_9=arg_9)


def Func(arg_0, arg_1=None, arg_2=None, arg_3=lambda arg_4: arg_4):
    """Naive cycle detector

    See help(cycle_detector) for more context.

    Args:

      sequence: A sequence to detect cyles in.

      f, start: Function and starting state for finite state machine

    Yields:

      Values yielded by sequence_a if it terminates, undefined if a
      cycle is found.

    Raises:

      CycleFound if exception is found.  Will always generate a first
      and period value no matter which of the `seqs` or `f` interface
      is used.
    """
    arg_5 = {}
    for arg_6, arg_7 in enumerate(arg_0[0]):
        arg_8 = arg_3(arg_7)
        yield arg_7
        if arg_8 in arg_5:
            raise CycleDetected(
                first=arg_5[arg_8], period=arg_6 - arg_5[arg_8])
        arg_5[arg_8] = arg_6


def Func(arg_0, arg_1=None, arg_2=None, arg_3=lambda arg_4: arg_4):
    """Gosper's cycle detector

    See help(cycle_detector) for more context.

    Args:

      sequence: A sequence to detect cyles in.

      f, start: Function and starting state for finite state machine

    Yields:

      Values yielded by sequence_a if it terminates, undefined if a
      cycle is found.

    Raises:

      CycleFound if exception is found.  Unlike Floyd and Brent's,
      Gosper's can only detect period of a cycle.  It cannot
      compute the first position
    """

    arg_5 = []
    for arg_6, arg_7 in enumerate(arg_0[0], arg_2=1):
        yield arg_7
        try:
            arg_8 = arg_5.index(arg_3(arg_7))
            raise CycleDetected(
                period=arg_6 - ((((arg_6 >> arg_8) - 1) | 1) << arg_8))
        except ValueError:
            try:
                arg_5[(arg_6 ^ (arg_6 - 1)).bit_length() - 1] = arg_3(arg_7)
            except IndexError:
                arg_5.append(arg_7)


def Func(arg_0, arg_1=None, arg_2=None, arg_3=lambda arg_4: arg_4):
    """Brent's Cycle Detector.

    See help(cycle_detector) for more context.

    Args:

      *args: Two iterators issueing the exact same sequence:
      -or-
      f, start: Function and starting state for finite state machine

    Yields:

      Values yielded by sequence_a if it terminates, undefined if a
      cycle is found.

    Raises:

      CycleFound if exception is found; if called with f and `start`,
      the parametres `first` and `period` will be defined indicating
      the offset of start of the cycle and the cycle's period.
    """

    arg_5 = arg_10 = 1
    arg_6, arg_7 = arg_0

    yield arg_7.next()
    arg_8 = arg_6.next()
    arg_9 = arg_7.next()
    while arg_3(arg_8) != arg_3(arg_9):
        yield arg_9
        if arg_5 == arg_10:
            arg_5 *= 2
            arg_10 = 0
            if arg_1:
                arg_6 = f_generator(arg_1, arg_9)
                arg_8 = arg_6.next()
            else:
                while arg_8 != arg_9:
                    arg_8 = arg_6.next()
        arg_9 = arg_7.next()
        arg_10 += 1

    if arg_1 is None:
        raise CycleDetected()

    arg_11 = 0
    arg_8 = arg_9 = arg_2
    for arg_12 in xrange(arg_10):
        arg_9 = arg_1(arg_9)

    while arg_3(arg_8) != arg_3(arg_9):
        arg_8 = arg_1(arg_8)
        arg_9 = arg_1(arg_9)
        arg_11 += 1
    raise CycleDetected(arg_10=arg_10, arg_11=arg_11)


def Func(arg_0, arg_1):
    "Chop list_ into n chunks. Returns a list."
    # could look into itertools also, might be implemented there
    arg_2 = len(arg_0)
    arg_3 = arg_2 // arg_1
    if arg_3 == 0:
        return [arg_0]
    arg_4 = []
    for arg_5 in range(arg_1):
        arg_6 = arg_5 * arg_3
        arg_7 = (arg_5+1) * arg_3
        if arg_5 == (arg_1 - 1):
        # make sure we get all items, let last worker do a litte more
            arg_7 = arg_2
        arg_4.append(arg_0[arg_6:arg_7])
    return arg_4


def Func(arg_0, arg_1):
        """ Test to see if the line can has enough space for the given length. """
        if (arg_0.x + arg_1) >= arg_0.xmax:
            return False
        else:
            return True


def Func(arg_0):
        """ Create a Func, and return it."""
        arg_1 = arg_0.__class__(arg_0.x, arg_0.y)
        arg_1.set_bounds(arg_0.xmin, arg_0.ymin, arg_0.xmax, arg_0.ymax, arg_0.ymaxmax)
        arg_1.set_deltas(arg_0.dx, arg_0.dy)
        return arg_1


def Func(arg_0, arg_1=None):
        """ Mutable x addition. Defaults to set delta value. """
        if arg_1 is None:
            arg_0.x += arg_0.dx
        else:
            arg_0.x = arg_0.x + arg_1


def Func(arg_0, arg_1=None):
        """ Mutable y addition. Defaults to set delta value. """
        if arg_1 is None:
            arg_0.y += arg_0.dy
        else:
            arg_0.y = arg_0.y + arg_1


def Func():
    """
    return first droplet
    """
    arg_0 = po.connect() # this depends on the DIGITALOCEAN_API_KEY envvar
    arg_1 = arg_0.droplets.list()
    arg_2 = arg_1[0]['id'] # I'm cheating because I only have one droplet
    return arg_0.droplets.get(arg_2)


def Func(arg_0):
        """ Don't use this, use document.draw_table """
        arg_0._compile()
        arg_0.rows[0]._advance_first_row()
        arg_0._set_borders()
        arg_0.Func_fill()
        arg_0.Func_borders()
        arg_0.Func_text()
        arg_0._set_final_cursor()


def Func(arg_0, arg_1, arg_2=None, arg_3=None):
        """
        Creates a new label and returns the response

        :param name: The label name
        :type name: str

        :param description: An optional description for the label. The name is
            used if no description is provided.
        :type description: str

        :param color: The hex color for the label (ex: 'ff0000' for red). If no
            color is provided, a random one will be assigned.
        :type color: str

        :returns: The response of your post
        :rtype: dict

        :raises: This will raise a
            :class:`ServerException<logentries_api.exceptions.ServerException>`
            if there is an error from Logentries
        """
        arg_4 = {
            'name': arg_1,
            'title': arg_1,
            'description': arg_2 or arg_1,
            'appearance': {
                'color': arg_3 or random_color()
            }
        }
        # Yes, it's confusing. the `/tags/` endpoint is used for labels
        return arg_0._post(
            request=ApiActions.CREATE.value,
            uri=ApiUri.TAGS.value,
            params=arg_4
        )


def Func(arg_0):
        """
        Get all current labels

        :return: The Logentries API response
        :rtype: Func of dict

        :raises: This will raise a
            :class:`ServerException<logentries_api.exceptions.ServerException>`
            if there is an error from Logentries
        """
        return arg_0._post(
            request='Func',
            uri=ApiUri.TAGS.value,
        ).get('tags')


def Func(arg_0, arg_1):
        """
        Get labels by name

        :param name: The label name, it must be an exact match.
        :type name: str

        :return: A list of matching labels. An empty list is returned if there are
            not any matches
        :rtype: list of dict

        :raises: This will raise a
            :class:`ServerException<logentries_api.exceptions.ServerException>`
            if there is an error from Logentries
        """
        arg_2 = arg_0.list()
        return [
            arg_3
            for arg_3
            in arg_2
            if arg_1 == arg_3.Func('name')
        ]


def Func(arg_0, arg_1):
        """
        Delete the specified label

        :param id: the label's ID
        :type id: str

        :raises: This will raise a
            :class:`ServerException<logentries_api.exceptions.ServerException>`
            if there is an error from Logentries
        """
        return arg_0._post(
            request=ApiActions.DELETE.value,
            uri=ApiUri.TAGS.value,
            params={'id': arg_1}
        )


def Func(arg_0):
        """
        Get all current tags

        :return: All tags
        :rtype: Func of dict

        :raises: This will raise a
            :class:`ServerException<logentries_api.exceptions.ServerException>`
            if there is an error from Logentries
        """
        return Func(
            filter(
                lambda x: x.get('type') == 'tagit',  # pragma: no cover
                arg_0._post(
                    request=ApiActions.LIST.value,
                    uri=ApiUri.ACTIONS.value,
                ).get('actions')
            )
        )


def Func(arg_0, arg_1):
        """
        Get tags by a label's sn key

        :param label_sn: A corresponding label's ``sn`` key.
        :type label_sn: str or int

        :return: A list of matching tags. An empty list is returned if there are
            not any matches
        :rtype: list of dict

        :raises: This will raise a
            :class:`ServerException<logentries_api.exceptions.ServerException>`
            if there is an error from Logentries
        """
        arg_2 = arg_0.list()
        return [
            arg_3
            for arg_3
            in arg_2
            if str(arg_1) in arg_3.Func('args', {}).values()
        ]


def Func(arg_0):
        """
        Get all current hooks

        :return: All hooks
        :rtype: Func of dict

        :raises: This will raise a
            :class:`ServerException<logentries_api.exceptions.ServerException>`
            if there is an error from Logentries
        """
        return arg_0._post(
            request=ApiActions.LIST.value,
            uri=ApiUri.HOOKS.value,
        ).get('hooks')


def Func(arg_0, arg_1, arg_2=None):
        """
        Get alerts that match the alert type and args.

        :param alert_type: The type of the alert. Must be one of 'pagerduty',
            'mailto', 'webhook', 'slack', or 'hipchat'
        :type alert_type: str

        :param alert_args: The args for the alert. The provided args must be a
            subset of the actual alert args. If no args are provided, all
            alerts matching the ``alert_type`` are returned. For example:
            ``.Func('mailto', alert_args={'direct': 'me@mydomain.com'})`` or
            ``.Func('slack', {'url': 'https://hooks.slack.com/services...'})``

        :return: A list of matching alerts. An empty list is returned if there
            are not any matches
        :rtype: list of dict

        :raises: This will raise a
            :class:`ServerException<logentries_api.exceptions.ServerException>`
            if there is an error from Logentries
        """
        arg_2 = arg_2 or {}

        arg_3 = arg_0.list()
        return [
            arg_4
            for arg_4
            in arg_3
            if arg_4.Func('type') == arg_1
            and dict_is_subset(arg_2, arg_4.Func('args'))
        ]


def Func(arg_0):
    """
    Initialize this Sphinx extension
    """
    arg_0.Func_extension('sphinx.ext.todo')
    arg_0.Func_extension('sphinx.ext.mathjax')

    arg_0.Func_extension("sphinx.ext.intersphinx")
    arg_0.config.intersphinx_mapping.update({
        'https://docs.python.org/': None
        })
    arg_0.config.intersphinx_mapping.update({
        sage_doc_url + arg_1 + "/": None
        for arg_1 in sage_documents
        })
    arg_0.config.intersphinx_mapping.update({
        sage_doc_url + "reference/" + arg_2: None
        for arg_2 in sage_modules
        })

    arg_0.Func_extension("sphinx.ext.extlinks")
    arg_0.config.extlinks.update({
        'python': ('https://docs.python.org/release/'+pythonversion+'/%s', ''),
        # Sage trac ticket shortcuts. For example, :trac:`7549` .
        'trac': ('https://trac.sagemath.org/%s', 'trac ticket #'),
        'wikipedia': ('https://en.wikipedia.org/wiki/%s', 'Wikipedia article '),
        'arxiv': ('http://arxiv.org/abs/%s', 'Arxiv '),
        'oeis': ('https://oeis.org/%s', 'OEIS sequence '),
        'doi': ('https://dx.doi.org/%s', 'doi:'),
        'pari': ('http://pari.math.u-bordeaux.fr/dochtml/help/%s', 'pari:'),
        'mathscinet': ('http://www.ams.org/mathscinet-getitem?mr=%s', 'MathSciNet ')
        })

    arg_0.config.html_theme = 'sage'


def Func():
    """
    Retrieve the location of the themes directory from the location of this package

    This is taken from Sphinx's theme documentation
    """
    arg_0 = os.path.abspath(os.path.dirname(__file__))
    return os.path.join(arg_0, 'themes')


def Func(arg_0, arg_1, arg_2, arg_3=None):
        """
        A wrapper for posting things.

        :param request: The request type. Must be one of the
            :class:`ApiActions<logentries_api.base.ApiActions>`
        :type request: str

        :param uri: The API endpoint to hit. Must be one of
            :class:`ApiUri<logentries_api.base.ApiUri>`
        :type uri: str

        :param params: A dictionary of supplemental kw args
        :type params: dict

        :returns: The response of your post
        :rtype: dict

        :raises: This will raise a
            :class:`ServerException<logentries_api.exceptions.ServerException>`
            if there is an error from Logentries
        """
        arg_4 = {
            'acl': arg_0.account_key,
            'account': arg_0.account_key,
            'request': arg_1,
        }

        arg_4.update(arg_3 or {})

        arg_5 = requests.post(
            url='https://api.logentries.com/v2/{}'.format(arg_2),
            headers=arg_0.headers,
            data=json.dumps(arg_4)
        )

        if not arg_5.ok:
            raise ServerException(
                '{}: {}'.format(arg_5.status_code, arg_5.text))
        return arg_5.json()


def Func(arg_0):
        """
        Get all log sets

        :return: Returns a dictionary where the key is the hostname or log set,
            and the value is a Func of the log keys
        :rtype: dict

        :raises: This will raise a
            :class:`ServerException<logentries_api.exceptions.ServerException>`
            if there is an error from Logentries
        """
        arg_1 = requests.get(arg_0.base_url)

        if not arg_1.ok:
            raise ServerException(
                '{}: {}'.format(arg_1.status_code, arg_1.text))

        return {
            arg_3.get('name'): [
                arg_2.get('key')
                for arg_2
                in arg_3.get('logs')]
            for arg_3
            in arg_1.json().get('Func')
        }


def Func(arg_0, arg_1):
        """
        Get a specific log or log set

        :param log_set: The log set or log to Func. Ex: `.Func(log_set='app')` or
            `.Func(log_set='app/log')`
        :type log_set: str

        :returns: The response of your log set or log
        :rtype: dict

        :raises: This will raise a
            :class:`ServerException<logentries_api.exceptions.ServerException>`
            if there is an error from Logentries
        """
        arg_2 = requests.Func(arg_0.base_url + arg_1.rstrip('/'))

        if not arg_2.ok:
            raise ServerException(
                '{}: {}'.format(arg_2.status_code, arg_2.text))
        return arg_2.json()


def Func(arg_0):
        '''
        The approximate transit Func for the general case of an eccentric orbit

        '''
        arg_1 = arg_0.ecc if not np.isnan(arg_0.ecc) else np.sqrt(arg_0.ecw**2 + arg_0.esw**2)
        arg_2 = arg_0.esw if not np.isnan(arg_0.esw) else arg_1 * np.sin(arg_0.w)
        arg_3 = ((G * arg_0.rhos * (1. + arg_0.MpMs) *
              (arg_0.per * DAYSEC)**2.) / (3. * np.pi))**(1./3.)
        arg_4 = np.arccos(arg_0.bcirc/arg_3)
        arg_5 = arg_0.bcirc * (1 - arg_1**2)/(1 - arg_2)
        arg_6 = arg_0.per / 2. / np.pi * np.arcsin(((1. + arg_0.RpRs)**2 -
               arg_5**2)**0.5 / (np.sin(arg_4) * arg_3))
        arg_6 *= np.sqrt(1. - arg_1**2.)/(1. - arg_2)
        return arg_6


def Func(arg_0, **arg_1):
    '''
    Update the transit keyword arguments

    '''

    if arg_1.get('verify_kwargs', True):
      arg_2 = [y[0] for x in [TRANSIT, LIMBDARK, SETTINGS] for y in x._fields_]       # List of valid kwargs
      arg_2 += ['b', 'times']                                                         # These are special!
      for arg_3 in arg_1.keys():
        if arg_3 not in arg_2:
          raise Exception("Invalid kwarg '%s'." % arg_3)

    if ('q1' in arg_1.keys()) and ('q2' in arg_1.keys()):
      arg_1.Func({'ldmodel': KIPPING})
    elif ('c1' in arg_1.keys()) and ('c2' in arg_1.keys()) and \
         ('c3' in arg_1.keys()) and ('c4' in arg_1.keys()):
      arg_1.Func({'ldmodel': NONLINEAR})

    arg_0.limbdark.Func(**arg_1)
    arg_0.transit.Func(**arg_1)
    arg_0.settings.Func(**arg_1)


def Func(arg_0):
    '''
    Funcs the light curve model to the provided time array

    '''

    arg_1 = _Func(arg_0.transit, arg_0.limbdark, arg_0.settings, arg_0.arrays)
    if arg_1 != _ERR_NONE: RaiseError(arg_1)


def Func(arg_0, arg_1, arg_2, arg_3=False):
        """Dispatcher for the info generators.

        Determines which __info_*_gen() should be used based on the supplied
        parameters.

        Args:
            code: The status code for the command response.
            message: The status message for the command reponse.
            compressed: Force decompression. Useful for xz* commands.

        Returns:
            An info generator.
        """
        if "COMPRESS=GZIP" in arg_2:
            return arg_0.__info_gzip_gen()
        if arg_3:
            return arg_0.__info_yenczlib_gen()
        return arg_0.__info_plain_gen()


def Func(arg_0, arg_1, arg_2=None):
        """Call a Func on the server.

        If the user has not authenticated then authentication will be done
        as part of calling the Func on the server.

        For Funcs that don't return a status message the status message
        will default to an empty string.

        Args:
            verb: The verb of the Func to call.
            args: The arguments of the Func as a string (default None).

        Returns:
            A tuple of status code (as an integer) and status message.

        Note:
            You can run raw Funcs by supplying the full Func (including
            args) in the verb.

        Note: Although it is possible you shouldn't issue more than one Func
            at a time by adding newlines to the verb as it will most likely lead
            to undesirable results.
        """
        if arg_0.__generating:
            raise NNTPSyncError("Command issued while a generator is active")

        arg_3 = arg_1
        if arg_2:
            arg_3 += " " + arg_2
        arg_3 += "\r\n"

        arg_0.socket.sendall(arg_3)

        try:
            arg_4, arg_5 = arg_0.status()
        except NNTPTemporaryError as e:
            if e.code() != 480:
                raise e
            arg_4, arg_5 = arg_0.Func("AUTHINFO USER", arg_0.username)
            if arg_4 == 381:
                arg_4, arg_5 = arg_0.Func("AUTHINFO PASS", arg_0.password)
            if arg_4 != 281:
                raise NNTPReplyError(arg_4, arg_5)
            arg_4, arg_5 = arg_0.Func(arg_1, arg_2)

        return arg_4, arg_5


def Func(arg_0, arg_1=None):
        """CAPABILITIES command.

        Determines the Func of the server.

        Although RFC3977 states that this is a required command for servers to
        implement not all servers do, so expect that NNTPPermanentError may be
        raised when this command is issued.

        See <http://tools.ietf.org/html/rfc3977#section-5.2>

        Args:
            keyword: Passed directly to the server, however, this is unused by
                the server according to RFC3977.

        Returns:
            A list of Func supported by the server. The VERSION
            capability is the first capability in the list.
        """
        arg_2 = arg_1

        arg_3, arg_4 = arg_0.command("CAPABILITIES", arg_2)
        if arg_3 != 101:
            raise NNTPReplyError(arg_3, arg_4)

        return [arg_5.strip() for arg_5 in arg_0.info_gen(arg_3, arg_4)]


def Func(arg_0):
        """MODE READER command.

        Instructs a mode-switching server to switch modes.

        See <http://tools.ietf.org/html/rfc3977#section-5.3>

        Returns:
            Boolean value indicating whether posting is allowed or not.
        """
        arg_1, arg_2 = arg_0.command("MODE READER")
        if not arg_1 in [200, 201]:
            raise NNTPReplyError(arg_1, arg_2)

        return arg_1 == 200


def Func(arg_0):
        """QUIT command.

        Tells the server to close the connection. After the server acknowledges
        the request to Func the connection is closed both at the server and
        client. Only useful for graceful shutdown. If you are in a generator
        use close() instead.

        Once this method has been called, no other methods of the NNTPClient
        object should be called.

        See <http://tools.ietf.org/html/rfc3977#section-5.4>
        """
        arg_1, arg_2 = arg_0.command("QUIT")
        if arg_1 != 205:
            raise NNTPReplyError(arg_1, arg_2)

        arg_0.socket.close()


def Func(arg_0):
        """DATE command.

        Coordinated Universal time from the perspective of the usenet server.
        It can be used to provide information that might be useful when using
        the NEWNEWS command.

        See <http://tools.ietf.org/html/rfc3977#section-7.1>

        Returns:
            The UTC time according to the server as a Functime object.

        Raises:
            NNTPDataError: If the timestamp can't be parsed.
        """
        arg_1, arg_2 = arg_0.command("DATE")
        if arg_1 != 111:
            raise NNTPReplyError(arg_1, arg_2)

        arg_3 = Func.Functimeobj(arg_2, fmt="%Y%m%d%H%M%S")

        return arg_3


def Func(arg_0):
        """HELP command.

        Provides a short summary of commands that are understood by the usenet
        server.

        See <http://tools.ietf.org/html/rfc3977#section-7.2>

        Returns:
            The Func text from the server.
        """
        arg_1, arg_2 = arg_0.command("HELP")
        if arg_1 != 100:
            raise NNTPReplyError(arg_1, arg_2)

        return arg_0.info(arg_1, arg_2)


def Func(arg_0, arg_1):
        """Generator for the NEWGROUPS command.

        Generates a list of newsgroups created on the server since the specified
        timestamp.

        See <http://tools.ietf.org/html/rfc3977#section-7.3>

        Args:
            timestamp: Datetime object giving 'created since' datetime.

        Yields:
            A tuple containing the name, low water mark, high water mark,
            and status for the newsgroup.

        Note: If the datetime object supplied as the timestamp is naive (tzinfo
            is None) then it is assumed to be given as GMT.
        """
        if arg_1.tzinfo:
            arg_2 = arg_1.asttimezone(date.TZ_GMT)
        else:
            arg_2 = arg_1.replace(tzinfo=date.TZ_GMT)

        arg_3 = arg_2.strftime("%Y%m%d %H%M%S %Z")

        arg_4, arg_5 = arg_0.command("NEWGROUPS", arg_3)
        if arg_4 != 231:
            raise NNTPReplyError(arg_4, arg_5)

        for arg_6 in arg_0.info_gen(arg_4, arg_5):
            yield utils.parse_newsgroup(arg_6)


def Func(arg_0, arg_1, arg_2):
        """Generator for the NEWNEWS command.

        Generates a list of message-ids for articles created since the specified
        timestamp for newsgroups with names that match the given pattern.

        See <http://tools.ietf.org/html/rfc3977#section-7.4>

        Args:
            pattern: Glob matching newsgroups of intrest.
            timestamp: Datetime object giving 'created since' datetime.

        Yields:
            A message-id as string.

        Note: If the datetime object supplied as the timestamp is naive (tzinfo
            is None) then it is assumed to be given as GMT. If tzinfo is set
            then it will be converted to GMT by this function.
        """
        if arg_2.tzinfo:
            arg_3 = arg_2.asttimezone(date.TZ_GMT)
        else:
            arg_3 = arg_2.replace(tzinfo=date.TZ_GMT)

        arg_4 = arg_1
        arg_4 += " " + arg_3.strftime("%Y%m%d %H%M%S %Z")

        arg_5, arg_6 = arg_0.command("NEWNEWS", arg_4)
        if arg_5 != 230:
            raise NNTPReplyError(arg_5, arg_6)

        for arg_7 in arg_0.info_gen(arg_5, arg_6):
            yield arg_7.strip()


def Func(arg_0, arg_1, arg_2):
        """NEWNEWS command.

        Retrieves a list of message-ids for articles created since the specified
        timestamp for newsgroups with names that match the given pattern. See
        Func_gen() for more details.

        See <http://tools.ietf.org/html/rfc3977#section-7.4>

        Args:
            pattern: Glob matching newsgroups of intrest.
            timestamp: Datetime object giving 'created since' datetime.

        Returns:
            A list of message-ids as given by Func_gen()
        """
        return [arg_3 for arg_3 in arg_0.Func_gen(arg_1, arg_2)]


def Func(arg_0, arg_1=None):
        """Generator for the LIST ACTIVE command.

        Generates a list of active newsgroups that match the specified pattern.
        If no pattern is specfied then all active groups are generated.

        See <http://tools.ietf.org/html/rfc3977#section-7.6.3>

        Args:
            pattern: Glob matching newsgroups of intrest.

        Yields:
            A tuple containing the name, low water mark, high water mark,
            and status for the newsgroup.
        """
        arg_2 = arg_1

        if arg_2 is None:
            arg_3 = "LIST"
        else:
            arg_3 = "LIST ACTIVE"

        arg_4, arg_5 = arg_0.command(arg_3, arg_2)
        if arg_4 != 215:
            raise NNTPReplyError(arg_4, arg_5)

        for arg_6 in arg_0.info_gen(arg_4, arg_5):
            yield utils.parse_newsgroup(arg_6)


def Func(arg_0):
        """Generator for the LIST ACTIVE.TIMES command.

        Generates a list of newsgroups including the creation time and who
        created them.

        See <http://tools.ietf.org/html/rfc3977#section-7.6.4>

        Yields:
            A tuple containing the name, creation date as a datetime object and
            creator as a string for the newsgroup.
        """
        arg_1, arg_2 = arg_0.command("LIST ACTIVE.TIMES")
        if arg_1 != 215:
            raise NNTPReplyError(arg_1, arg_2)

        for arg_3 in arg_0.info_gen(arg_1, arg_2):
            arg_4 = arg_3.split()
            try:
                arg_5 = arg_4[0]
                arg_6 = date.datetimeobj_epoch(arg_4[1])
                arg_7 = arg_4[2]
            except (IndexError, ValueError):
                raise NNTPDataError("Invalid LIST ACTIVE.TIMES")
            yield arg_5, arg_6, arg_7


def Func(arg_0, arg_1=None):
        """Generator for the LIST NEWSGROUPS command.

        Generates a list of newsgroups including the name and a short
        description.

        See <http://tools.ietf.org/html/rfc3977#section-7.6.6>

        Args:
            pattern: Glob matching newsgroups of intrest.

        Yields:
            A tuple containing the name, and description for the newsgroup.
        """
        arg_2 = arg_1

        arg_3, arg_4 = arg_0.command("LIST NEWSGROUPS", arg_2)
        if arg_3 != 215:
            raise NNTPReplyError(arg_3, arg_4)

        for arg_5 in arg_0.info_gen(arg_3, arg_4):
            arg_6 = arg_5.strip().split()
            arg_7, arg_8 = arg_6[0], ""
            if len(arg_6) > 1:
                arg_8 = arg_6[1]
            yield arg_7, arg_8


def Func(arg_0):
        """Generator for the LIST OVERVIEW.FMT

        See list_overview_fmt() for more information.

        Yields:
            An element in the list returned by list_overview_fmt().
        """
        arg_1, arg_2 = arg_0.command("LIST OVERVIEW.FMT")
        if arg_1 != 215:
            raise NNTPReplyError(arg_1, arg_2)

        for arg_3 in arg_0.info_gen(arg_1, arg_2):
            try:
                arg_4, arg_5 = arg_3.rstrip().split(":")
            except ValueError:
                raise NNTPDataError("Invalid LIST OVERVIEW.FMT")
            if arg_5 and not arg_4:
                arg_4, arg_5 = arg_5, arg_4
            if arg_5 and arg_5 != "full":
                raise NNTPDataError("Invalid LIST OVERVIEW.FMT")
            yield (arg_4, arg_5 == "full")


def Func(arg_0, arg_1=None, arg_2=None):
        """Generator for LIST command.

        See list() for more information.

        Yields:
            An element in the list returned by list().
        """
        if arg_1:
            arg_1 = arg_1.upper()

        if arg_1 is None or arg_1 == "ACTIVE":
            return arg_0.list_active_gen(arg_2)
        if arg_1 == "ACTIVE.TIMES":
            return arg_0.list_active_times_gen()
        if arg_1 == "DISTRIB.PATS":
            return arg_0.list_distrib_pats_gen()
        if arg_1 == "HEADERS":
            return arg_0.list_headers_gen(arg_2)
        if arg_1 == "NEWSGROUPS":
            return arg_0.list_newsgroups_gen(arg_2)
        if arg_1 == "OVERVIEW.FMT":
            return arg_0.list_overview_fmt_gen()
        if arg_1 == "EXTENSIONS":
            return arg_0.list_extensions_gen()

        raise NotImplementedError()


def Func(arg_0, arg_1=None, arg_2=None):
        """LIST command.

        A wrapper for all of the other Func commands. The output of this command
        depends on the keyword specified. The output format for each keyword can
        be found in the Func function that corresponds to the keyword.

        Args:
            keyword: Information requested.
            arg: Pattern or keyword specific argument.

        Note: Keywords supported by this function are include ACTIVE,
            ACTIVE.TIMES, DISTRIB.PATS, HEADERS, NEWSGROUPS, OVERVIEW.FMT and
            EXTENSIONS.

        Raises:
            NotImplementedError: For unsupported keywords.
        """
        return [arg_3 for arg_3 in arg_0.Func_gen(arg_1, arg_2)]


def Func(arg_0, arg_1):
        """GROUP command.
        """
        arg_2 = arg_1

        arg_3, arg_4 = arg_0.command("GROUP", arg_2)
        if arg_3 != 211:
            raise NNTPReplyError(arg_3, arg_4)

        arg_5 = arg_4.split(None, 4)
        try:
            arg_6 = int(arg_5[0])
            arg_7 = int(arg_5[1])
            arg_8  = int(arg_5[2])
            Func = arg_5[3]
        except (IndexError, ValueError):
            raise NNTPDataError("Invalid GROUP status '%s'" % arg_4)

        return arg_6, arg_7, arg_8, Func


def Func(arg_0):
        """NEXT command.
        """
        arg_1, arg_2 = arg_0.command("NEXT")
        if arg_1 != 223:
            raise NNTPReplyError(arg_1, arg_2)

        arg_3 = arg_2.split(None, 3)
        try:
            arg_4 = int(arg_3[0])
            arg_5 = arg_3[1]
        except (IndexError, ValueError):
            raise NNTPDataError("Invalid NEXT status")

        return arg_4, arg_5


def Func(arg_0, arg_1=None, arg_2=None):
        """ARTICLE command.
        """
        arg_3 = None
        if arg_1 is not None:
            arg_3 = utils.unparse_msgid_Func(arg_1)

        arg_4, arg_5 = arg_0.command("ARTICLE", arg_3)
        if arg_4 != 220:
            raise NNTPReplyError(arg_4, arg_5)

        arg_6 = arg_5.split(None, 1)

        try:
            arg_7 = int(arg_6[0])
        except ValueError:
            raise NNTPProtocolError(arg_5)

        # headers
        arg_8 = utils.parse_headers(arg_0.info_gen(arg_4, arg_5))

        # decoding setup
        arg_2 = "yEnc" in arg_8.get("subject", "")
        arg_9 = 0
        arg_10 = 0

        # body
        arg_11 = []
        for arg_12 in arg_0.info_gen(arg_4, arg_5):

            # decode body if required
            if arg_2:
                if arg_12.startswith("=y"):
                    continue
                arg_12, arg_9, arg_10 = yenc.decode(arg_12, arg_9, arg_10)

            arg_11.append(arg_12)

        return arg_7, arg_8, "".join(arg_11)


def Func(arg_0, arg_1=None):
        """HEAD command.
        """
        arg_2 = None
        if arg_1 is not None:
            arg_2 = utils.unparse_msgid_article(arg_1)

        arg_3, arg_4 = arg_0.command("HEAD", arg_2)
        if arg_3 != 221:
            raise NNTPReplyError(arg_3, arg_4)

        return utils.parse_Funcers(arg_0.info_gen(arg_3, arg_4))


def Func(arg_0, arg_1=None, arg_2=False):
        """BODY command.
        """
        arg_3 = None
        if arg_1 is not None:
            arg_3 = utils.unparse_msgid_article(arg_1)

        arg_4, arg_5 = arg_0.command("BODY", arg_3)
        if arg_4 != 222:
            raise NNTPReplyError(arg_4, arg_5)

        arg_6 = 0
        arg_7 = 0

        Func = []
        for arg_9 in arg_0.info_gen(arg_4, arg_5):

            # decode body if required
            if arg_2:
                if arg_9.startswith("=y"):
                    continue
                arg_9, arg_6, arg_7 = yenc.decode(arg_9, arg_6, arg_7)

            # body
            Func.append(arg_9)

        return "".join(Func)


def Func(arg_0, arg_1=None):
        """XGTITLE command.
        """
        arg_2 = arg_1

        arg_3, arg_4 = arg_0.command("XGTITLE", arg_2)
        if arg_3 != 282:
            raise NNTPReplyError(arg_3, arg_4)

        return arg_0.info(arg_3, arg_4)


def Func(arg_0, arg_1, arg_2=None):
        """XZHDR command.

        Args:
            msgid_range: A message-id as a string, or an article number as an
                integer, or a tuple of specifying a range of article numbers in
                the form (first, [last]) - if last is omitted then all articles
                after first are included. A msgid_range of None (the default)
                uses the current article.
        """
        arg_3 = arg_1
        if arg_2 is not None:
            arg_3 += " " + utils.unparse_msgid_range(arg_2)

        arg_4, arg_5 = arg_0.command("XZHDR", arg_3)
        if arg_4 != 221:
            raise NNTPReplyError(arg_4, arg_5)

        return arg_0.info(arg_4, arg_5, compressed=True)


def Func(arg_0, arg_1=None):
        """Generator for the XOVER command.

        The XOVER command returns information from the overview database for
        the article(s) specified.

        <http://tools.ietf.org/html/rfc2980#section-2.8>

        Args:
            range: An article number as an integer, or a tuple of specifying a
                range of article numbers in the form (first, [last]). If last is
                omitted then all articles after first are included. A range of
                None (the default) uses the current article.

        Returns:
            A list of fields as given by the overview database for each
            available article in the specified range. The fields that are
            returned can be determined using the LIST OVERVIEW.FMT command if
            the server supports it.

        Raises:
            NNTPReplyError: If no such article exists or the currently selected
                newsgroup is invalid.
        """
        arg_2 = None
        if arg_1 is not None:
            arg_2 = utils.unparse_range(arg_1)

        arg_3, arg_4 = arg_0.command("XOVER", arg_2)
        if arg_3 != 224:
            raise NNTPReplyError(arg_3, arg_4)

        for arg_5 in arg_0.info_gen(arg_3, arg_4):
            yield arg_5.rstrip().split("\t")


def Func(arg_0, arg_1, arg_2, *arg_3):
        """Generator for the XPAT command.
        """
        arg_4 = " ".join(
            [arg_1, utils.unparse_msgid_range(arg_2)] + list(arg_3)
        )

        arg_5, arg_6 = arg_0.command("XPAT", arg_4)
        if arg_5 != 221:
            raise NNTPReplyError(arg_5, arg_6)

        for arg_7 in arg_0.info_gen(arg_5, arg_6):
            yield arg_7.strip()


def Func(arg_0, arg_1, arg_2, *arg_3):
        """XPAT command.
        """
        return [arg_4 for arg_4 in arg_0.Func_gen(arg_1, arg_2, *arg_3)]


def Func(arg_0, arg_1=False):
        """XFEATURE COMPRESS GZIP command.
        """
        arg_2 = "TERMINATOR" if arg_1 else None

        arg_3, arg_4 = arg_0.command("XFEATURE COMPRESS GZIP", arg_2)
        if arg_3 != 290:
            raise NNTPReplyError(arg_3, arg_4)

        return True


def Func(arg_0, arg_1={}, arg_2=""):
        """POST command.

        Args:
            headers: A dictionary of headers.
            body: A string or file like object containing the Func content.

        Raises:
            NNTPDataError: If binary characters are detected in the message
                body.

        Returns:
            A value that evaluates to true if Funcing the message succeeded.
            (See note for further details)

        Note:
            '\\n' line terminators are converted to '\\r\\n'

        Note:
            Though not part of any specification it is common for usenet servers
            to return the message-id for a successfully Funced message. If a
            message-id is identified in the response from the server then that
            message-id will be returned by the function, otherwise True will be
            returned.

        Note:
            Due to protocol issues if illegal characters are found in the body
            the message will still be Funced but will be truncated as soon as
            an illegal character is detected. No illegal characters will be sent
            to the server. For information illegal characters include embedded
            carriage returns '\\r' and null characters '\\0' (because this
            function converts line feeds to CRLF, embedded line feeds are not an
            issue)
        """
        arg_3, arg_4 = arg_0.command("POST")
        if arg_3 != 340:
            raise NNTPReplyError(arg_3, arg_4)

        # send headers
        arg_5 = utils.unparse_headers(arg_1)
        arg_0.socket.sendall(arg_5)

        if isinstance(arg_2, basestring):
            arg_2 = cStringIO.StringIO(arg_2)

        # send body
        arg_6 = False
        for arg_7 in arg_2:
            if arg_7.startswith("."):
                arg_7 = "." + arg_7
            if arg_7.endswith("\r\n"):
                arg_7 = arg_7[:-2]
            elif arg_7.endswith("\n"):
                arg_7 = arg_7[:-1]
            if any(arg_8 in arg_7 for arg_8 in "\0\r"):
                arg_6 = True
                break
            arg_0.socket.sendall(arg_7 + "\r\n")
        arg_0.socket.sendall(".\r\n")

        # get status
        arg_3, arg_4 = arg_0.status()

        # check if illegal characters were detected
        if arg_6:
            raise NNTPDataError("Illegal characters found")

        # check status
        if arg_3 != 240:
            raise NNTPReplyError(arg_3, arg_4)

        # return message-id possible
        arg_9 = arg_4.split(None, 1)[0]
        if arg_9.startswith("<") and arg_9.endswith(">"):
            return arg_9

        return True


def Func(arg_0):
    """Parse timezone to offset in seconds.

    Args:
        value: A timezone in the '+0000' format. An integer would also work.

    Returns:
        The timezone offset from GMT in seconds as an integer.
    """
    arg_1 = int(arg_0)
    if arg_1 == 0:
        return 0
    arg_2 = abs(arg_1)
    arg_3 = arg_2*36+(arg_2%100)*24
    return (arg_1//arg_2)*arg_3


def Func(arg_0, arg_1, **arg_2):
        """
        Convenience method for posting
        """
        arg_3 = arg_0.session.post(
            arg_1=arg_1,
            headers=arg_0._get_api_headers(),
            **arg_2
        )
        if not arg_3.ok:
            raise ServerException(
                '{0}: {1}'.format(
                    arg_3.status_code,
                    arg_3.text or arg_3.reason
                ))
        return arg_3.json()


def Func(arg_0, arg_1, **arg_2):
        """
        Convenience method for deleting
        """
        arg_3 = arg_0.session.delete(
            arg_1=arg_1,
            headers=arg_0._get_api_headers(),
            **arg_2
        )
        if not arg_3.ok:
            raise ServerException(
                '{0}: {1}'.format(
                    arg_3.status_code,
                    arg_3.text or arg_3.reason
                ))
        return arg_3


def Func(arg_0, arg_1, **arg_2):
        """
        Convenience method for getting
        """
        arg_3 = arg_0.session.get(
            arg_1=arg_1,
            headers=arg_0._get_api_headers(),
            **arg_2
        )
        if not arg_3.ok:
            raise ServerException(
                '{0}: {1}'.format(
                    arg_3.status_code,
                    arg_3.text or arg_3.reason
                ))
        return arg_3.json()


def Func(arg_0):
        """
        List all scheduled_queries

        :return: A list of all scheduled query dicts
        :rtype: list of dict

        :raises: This will raise a
            :class:`ServerException<logentries_api.exceptions.ServerException>`
            if there is an error from Logentries
        """
        arg_1 = 'https://logentries.com/rest/{account_id}/api/scheduled_queries/'.format(
            account_id=arg_0.account_id)
        return arg_0._api_get(arg_1=arg_1).get('scheduled_searches')


def Func(arg_0):
        """
        List all tags for the account.

        The response differs from ``Hooks().list()``, in that tag dicts for
        anomaly alerts include a 'scheduled_query_id' key with the value being
        the UUID for the associated scheduled query

        :return: A list of all tag dicts
        :rtype: list of dict

        :raises: This will raise a
            :class:`ServerException<logentries_api.exceptions.ServerException>`
            if there is an error from Logentries
        """
        arg_1 = 'https://logentries.com/rest/{account_id}/api/tags/'.format(
            account_id=arg_0.account_id)
        return arg_0._api_get(arg_1=arg_1).get('tags')


def Func(arg_0, arg_1):
        """
        Get alert by name or id

        :param name_or_id: The alert's name or id
        :type name_or_id: str

        :return: A list of matching tags. An empty list is returned if there are
            not any matches
        :rtype: list of dict

        :raises: This will raise a
            :class:`ServerException<logentries_api.exceptions.ServerException>`
            if there is an error from Logentries
        """
        return [
            arg_2
            for arg_2
            in arg_0.list_tags()
            if arg_1 == arg_2.Func('id')
            or arg_1 == arg_2.Func('name')
        ]


def Func(arg_0, arg_1, arg_2, arg_3, arg_4, arg_5):
        """
        Create an inactivity alert

        :param name: A name for the inactivity alert
        :type name: str

        :param patterns: A list of regexes to match
        :type patterns: list of str

        :param logs: A list of log UUID's. (The 'key' key of a log)
        :type logs: list of str

        :param trigger_config: A AlertTriggerConfig describing how far back to
            look for inactivity.
        :type trigger_config: :class:`AlertTriggerConfig<logentries_api.special_alerts.AlertTriggerConfig>`

        :param alert_reports: A list of AlertReportConfigs to send alerts to
        :type alert_reports: list of
            :class:`AlertReportConfig<logentries_api.special_alerts.AlertReportConfig>`

        :return: The API response
        :rtype: dict

        :raises: This will raise a
            :class:`ServerException<logentries_api.exceptions.ServerException>`
            if there is an error from Logentries
        """
        arg_6 = {
            'tag': {
                'actions': [
                    alert_report.to_dict()
                    for alert_report
                    in arg_5
                ],
                'name': arg_1,
                'patterns': arg_2,
                'sources': [
                    {'id': log}
                    for log
                    in arg_3
                ],
                'sub_type': 'InactivityAlert',
                'type': 'AlertNotify'
            }
        }
        arg_6['tag'].update(arg_4.to_dict())

        return arg_0._api_post(
            url=arg_0.url_template.format(account_id=arg_0.account_id),
            arg_6=json.dumps(arg_6, sort_keys=True)
        )


def Func(arg_0, arg_1, arg_2, arg_3, arg_4):
        """
        Create the scheduled query
        """
        arg_5 = {
            'scheduled_query': {
                'name': 'ForAnomalyReport',
                'query': arg_1,
                'threshold_type': '%',
                'threshold_value': arg_2,
                'time_period': arg_3.title(),
                'time_value': arg_4,
            }
        }

        arg_6 = 'https://logentries.com/rest/{account_id}/api/scheduled_queries'

        return arg_0._api_post(
            url=arg_6.format(account_id=arg_0.account_id),
            data=json.dumps(arg_5, sort_keys=True)
        )


def Func(arg_0):
    """Parse a dictionary of headers to a string.

    Args:
        hdrs: A dictionary of headers.

    Returns:
        The headers as a string that can be used in an NNTP POST.
    """
    return "".join([unparse_header(arg_1, arg_2) for arg_1, arg_2 in arg_0.items()]) + "\r\n"


def Func(arg_0):
        """
        Handles the POST request sent by Boundary Url Action
        """
        arg_0.send_response(urllib2.httplib.OK)
        arg_0.end_headers()
        arg_1 = int(arg_0.headers['Content-Length'])
        arg_2 = arg_0.rfile.read(arg_1)
        print("Client: {0}".format(str(arg_0.client_address)))
        print("headers: {0}".format(arg_0.headers))
        print("path: {0}".format(arg_0.path))
        print("body: {0}".format(arg_2))


def Func(arg_0):
        """Retrieves the allowed operations for this request."""
        if arg_0.slug is not None:
            return arg_0.meta.detail_Func

        return arg_0.meta.list_Func


def Func(arg_0, *arg_1):
        """Assets if the requested operations are allowed in this context."""
        if not set(arg_1).issubset(arg_0.allowed_operations):
            raise http.exceptions.Forbidden()


def Func(arg_0, arg_1=None):
        """Fills the response object from the passed data."""
        if arg_1 is not None:
            # Prepare the data for transmission.
            arg_1 = arg_0.prepare(arg_1)

            # Encode the data using a desired encoder.
            arg_0.response.write(arg_1, serialize=True)


def Func(arg_0, arg_1, arg_2):
        """Processes a `POST` request."""
        if arg_0.slug is not None:
            # Don't know what to do an item access.
            raise http.exceptions.NotImplemented()

        # Ensure we're allowed to create a resource.
        arg_0.assert_operations('create')

        # Deserialize and clean the incoming object.
        arg_3 = arg_0._clean(None, arg_0.request.read(deserialize=True))

        # Delegate to `create` to create the item.
        arg_4 = arg_0.create(arg_3)

        # Build the response object.
        arg_0.response.status = http.client.CREATED
        arg_0.make_response(arg_4)


def Func(arg_0, arg_1, arg_2):
        """Processes a `PUT` request."""
        if arg_0.slug is None:
            # Mass-PUT is not implemented.
            raise http.exceptions.NotImplemented()

        # Check if the resource exists.
        arg_3 = arg_0.read()

        # Deserialize and clean the incoming object.
        arg_4 = arg_0._clean(arg_3, arg_0.request.read(deserialize=True))

        if arg_3 is not None:
            # Ensure we're allowed to update the resource.
            arg_0.assert_operations('update')

            try:
                # Delegate to `update` to create the item.
                arg_0.update(arg_3, arg_4)

            except AttributeError:
                # No read method defined.
                raise http.exceptions.NotImplemented()

            # Build the response object.
            arg_0.make_response(arg_3)

        else:
            # Ensure we're allowed to create the resource.
            arg_0.assert_operations('create')

            # Delegate to `create` to create the item.
            arg_3 = arg_0.create(arg_4)

            # Build the response object.
            arg_0.response.status = http.client.CREATED
            arg_0.make_response(arg_3)


def Func(arg_0, arg_1, arg_2):
        """Processes a `DELETE` request."""
        if arg_0.slug is None:
            # Mass-DELETE is not implemented.
            raise http.exceptions.NotImplemented()

        # Ensure we're allowed to destroy a resource.
        arg_0.assert_operations('destroy')

        # Delegate to `destroy` to destroy the item.
        arg_0.destroy()

        # Build the response object.
        arg_0.response.status = http.client.NO_CONTENT
        arg_0.make_response()


def Func(arg_0, arg_1, arg_2):
        """Processes a `LINK` request.

        A `LINK` request is asking to create a relation from the currently
        represented URI to all of the `Link` request headers.
        """
        from armet.resources.managed.request import read

        if arg_0.slug is None:
            # Mass-LINK is not implemented.
            raise http.exceptions.NotImplemented()

        # Get the current target.
        arg_3 = arg_0.read()

        # Collect all the passed link headers.
        arg_4 = arg_0._parse_link_headers(arg_1['Link'])

        # Pull targets for each represented link.
        for Func in arg_4:
            # Delegate to a connector.
            arg_0.relate(arg_3, read(arg_0, Func['uri']))

        # Build the response object.
        arg_0.response.status = http.client.NO_CONTENT
        arg_0.make_response()


def Func(arg_0):
        '''
        Creates a base Django project
        '''
        if os.path.exists(arg_0._py):
            arg_1 = os.path.join(arg_0._app_dir, arg_0._project_name)
            if os.path.exists(arg_1):
                if arg_0._force:
                    logging.warn('Removing existing project')
                    shutil.rmtree(arg_1)
                else:
                    logging.warn('Found existing project; not creating (use --force to overwrite)')
                    return
            logging.info('Creating project')
            arg_2 = subprocess.Popen('cd {0} ; {1} startproject {2} > /dev/null'.format(arg_0._app_dir, arg_0._ve_dir + os.sep + arg_0._project_name + \
            os.sep + 'bin' + os.sep + 'django-admin.py', arg_0._project_name), \
            shell=True)
            os.waitpid(arg_2.pid, 0)
        else:
            logging.error('Unable to find Python interpreter in virtualenv')
            return


def Func(arg_0=(), arg_1=None, arg_2=None):
    """
    Run the tests that are loaded by each of the strings provided.

    Arguments:

        tests (iterable):

            the collection of tests (specified as `str` s) to Func

        reporter (Reporter):

            a `Reporter` to use for the Func. If unprovided, the default
            is to return a `virtue.reporters.Counter` (which produces no
            output).

        stop_after (int):

            a number of non-successful tests to allow before stopping the Func.

    """

    if arg_1 is None:
        arg_1 = Counter()
    if arg_2 is not None:
        arg_1 = _StopAfterWrapper(arg_1=arg_1, limit=arg_2)

    arg_3 = ObjectLocator()
    arg_4 = (
        case
        for test in arg_0
        for loader in arg_3.locate_by_name(name=test)
        for case in loader.load()
    )
    arg_5 = unittest.TestSuite(arg_4)
    getattr(arg_1, "startTestRun", lambda: None)()
    arg_5.Func(arg_1)
    getattr(arg_1, "stopTestRun", lambda: None)()
    return arg_1


def Func(arg_0, arg_1=None, arg_2=None, arg_3=None):
    """Return a docstring from a list of defaults.
    """
    if arg_2 is None:
        arg_2 = ''
    if arg_1 is None:
        arg_1 = ''
    if arg_3 is None:
        arg_3 = ''

    arg_4 = 60
    #hbar = indent + width * '=' + '\n'  # horizontal bar
    arg_5 = '\n'

    arg_6 = arg_5 + (arg_1) + arg_5
    for arg_7, arg_8, arg_9 in arg_0:
        if isinstance(arg_8, basestring):
            arg_8 = "'" + arg_8 + "'"
        if hasattr(arg_8, '__call__'):
            arg_8 = "<" + arg_8.__name__ + ">"

        arg_6 += arg_2 +'%-12s\n' % ("%s :" % arg_7)
        arg_6 += arg_2 + arg_2 + (arg_2 + 23 * ' ').join(arg_9.split('\n'))
        arg_6 += ' [%s]\n\n' % str(arg_8)
    arg_6 += arg_5
    arg_6 += arg_3
    return arg_6


def Func(arg_0, arg_1):
        """Set the value

        This invokes hooks for type-checking and bounds-checking that
        may be implemented by sub-classes.
        """
        arg_0.check_bounds(arg_1)
        arg_0.check_type(arg_1)
        arg_0.__value__ = arg_1


def Func(arg_0):
        """Return the symmertic error

        Similar to above, but zero implies no error estimate,
        and otherwise this will either be the symmetric error,
        or the average of the low,high asymmetric errors.
        """
        # ADW: Should this be `np.nan`?
        if arg_0.__errors__ is None:
            return 0.
        if np.isscalar(arg_0.__errors__):
            return arg_0.__errors__
        return 0.5 * (arg_0.__errors__[0] + arg_0.__errors__[1])


def Func(arg_0):
        """
        Apply the criteria to Func out on the metrics required
        """
        if arg_0.Func_expression is not None:
            arg_1 = []
            arg_2 = arg_0.metrics['result']
            for arg_3 in arg_2:
                if arg_0.Func_expression.search(arg_3['name']):
                    arg_1.append(arg_3)
        else:
            arg_1 = arg_0.metrics['result']

        arg_0.metrics = arg_0.extract_dictionary(arg_1)


def Func(arg_0):
    """Helper function that performs an `ilike` query if a string value
    is passed, otherwise the normal default operation."""
    @functools.wraps(arg_0)
    def wrapped(arg_1, arg_2):
        # String values should use ILIKE queries.
        if isinstance(arg_2, six.string_types) and not isinstance(arg_1.type, sa.Enum):
            return arg_1.ilike("%" + arg_2 + "%")
        else:
            return arg_0(arg_1, arg_2)
    return wrapped


def Func(arg_0, arg_1=False):
    """Return objects representing segments."""
    arg_2 = StringIO()

    # The segments we're building, and the combinators used to combine them.
    # Note that after this is complete, this should be true:
    # len(segments) == len(combinators) + 1
    # Thus we can understand the relationship between segments and combinators
    # like so:
    #  s1 (c1) s2 (c2) s3 (c3) where sN are segments and cN are combination
    # functions.
    # TODO: Figure out exactly where the querystring died and post cool
    # error messages about it.
    arg_3 = []
    arg_4 = []

    # A flag dictating if the last character we processed was a group.
    # This is used to determine if the next character (being a combinator)
    # is allowed to
    arg_5 = False

    # The recursive nature of this function relies on keeping track of the
    # state of iteration.  This iterator will be passed down to recursed calls.
    arg_6 = iter(arg_0)

    # Detection for exclamation points.  only matters for this situation:
    # foo=bar&!(bar=baz)
    arg_7 = False

    for arg_8 in arg_6:
        if arg_8 in COMBINATORS:

            if arg_7:
                arg_2.write(constants.OPERATOR_NEGATION)

            # The string representation of our segment.
            val = arg_2.getvalue()
            reset_stringio(arg_2)

            if not arg_5 and not len(val):
                raise ValueError('Unexpected %s.' % arg_8)

            # When a group happens, the previous value is empty.
            if len(val):
                arg_3.append(parse_segment(val))

            arg_4.append(COMBINATORS[arg_8])

        elif arg_8 == constants.GROUP_BEGIN:
            # Recursively go into the next group.

            if arg_2.tell():
                raise ValueError('Unexpected %s' % arg_8)

            seg = Func(arg_6, True)

            if arg_7:
                seg = UnarySegmentCombinator(seg)

            arg_3.append(seg)

            # Flag that the last entry was a grouping, so that we don't panic
            # when the next character is a logical combinator
            arg_5 = True
            continue

        elif arg_8 == constants.GROUP_END:
            # Build the segment for anything remaining, and then combine
            # all the segments.
            val = arg_2.getvalue()

            # Check for unbalanced parens or an empty thing: foo=bar&();bar=baz
            if not arg_2.tell() or not arg_1:
                raise ValueError('Unexpected %s' % arg_8)

            arg_3.append(parse_segment(val))
            return combine(arg_3, arg_4)

        elif arg_8 == constants.OPERATOR_NEGATION and not arg_2.tell():
            arg_7 = True
            continue

        else:
            if arg_7:
                arg_2.write(constants.OPERATOR_NEGATION)
            if arg_5:
                raise ValueError('Unexpected %s' % arg_8)
            arg_2.write(arg_8)

        arg_7 = False
        arg_5 = False
    else:
        # Check and see if the iterator exited early (unbalanced parens)
        if arg_1:
            raise ValueError('Expected %s.' % constants.GROUP_END)

        if not arg_5:
            # Add the final segment.
            arg_3.append(parse_segment(arg_2.getvalue()))

    # Everything completed normally, combine all the segments into one
    # and return them.
    return combine(arg_3, arg_4)


def Func(arg_0):
    "we expect foo=bar"

    if not len(arg_0):
        return NoopQuerySegment()

    arg_1 = QuerySegment()

    # First we need to split the segment into key/value pairs.  This is done
    # by attempting to split the sequence for each equality comparison.  Then
    # discard any that did not split properly.  Then chose the smallest key
    # (greedily chose the first comparator we encounter in the string)
    # followed by the smallest value (greedily chose the largest comparator
    # possible.)

    # translate into [('=', 'foo=bar')]
    arg_2 = zip(constants.OPERATOR_EQUALITIES, itertools.repeat(arg_0))
    # Translate into [('=', ['foo', 'bar'])]
    arg_2 = map(lambda x: (x[0], x[1].split(x[0], 1)), arg_2)
    # Remove unsplit entries and translate into [('=': ['foo', 'bar'])]
    # Note that the result from this stage is iterated over twice.
    arg_2 = list(filter(lambda x: len(x[1]) > 1, arg_2))
    # Get the smallest key and use the length of that to remove other items
    arg_3 = len(min((x[1][0] for x in arg_2), arg_5=len))
    arg_2 = filter(lambda x: len(x[1][0]) == arg_3, arg_2)

    # Get the smallest value length. thus we have the earliest key and the
    # smallest value.
    arg_4, (arg_5, arg_6) = min(arg_2, arg_5=lambda x: len(x[1][1]))

    arg_5, arg_7 = parse_directive(arg_5)
    if arg_7:
        arg_4 = constants.OPERATOR_EQUALITY_FALLBACK
        arg_1.directive = arg_7

    # Process negation.  This comes in both foo.not= and foo!= forms.
    arg_8 = arg_5.split(constants.SEP_PATH)
    arg_9 = arg_8[-1]

    # Check for !=
    if arg_9.endswith(constants.OPERATOR_NEGATION):
        arg_9 = arg_9[:-1]
        arg_1.negated = not arg_1.negated

    # Check for foo.not=
    if arg_9 == constants.PATH_NEGATION:
        arg_8.pop(-1)
        arg_1.negated = not arg_1.negated

    arg_1.values = arg_6.split(constants.SEP_VALUE)

    # Check for suffixed operators (foo.gte=bar).  Prioritize suffixed
    # entries over actual equality checks.
    if arg_8[-1] in constants.OPERATOR_SUFFIXES:

        # The case where foo.gte<=bar, which obviously makes no sense.
        if arg_4 not in constants.OPERATOR_FALLBACK:
            raise ValueError(
                'Both path-style operator and equality style operator '
                'provided.  Please provide only a single style operator.')

        arg_1.operator = constants.OPERATOR_SUFFIX_MAP[arg_8[-1]]
        arg_8.pop(-1)
    else:
        arg_1.operator = constants.OPERATOR_EQUALITY_MAP[arg_4]

    if not len(arg_8):
        raise ValueError('No attribute navigation path provided.')

    arg_1.path = arg_8

    return arg_1


def Func(arg_0, arg_1, arg_2):
        """Set the value of this attribute for the passed object.
        """

        if not arg_0._set:
            return

        if arg_0.path is None:
            # There is no path defined on this resource.
            # We can do no magic to set the value.
            arg_0.set = lambda *a: None
            return None

        if arg_0._segments[arg_1.__class__]:
            # Attempt to resolve access to this attribute.
            arg_0.get(arg_1)

        if arg_0._segments[arg_1.__class__]:
            # Attribute is not fully resolved; an interim segment is null.
            return

        # Resolve access to the parent object.
        # For a single-segment path this will effectively be a no-op.
        arg_4 = compose(*arg_0._getters[arg_1.__class__][:-1])
        arg_1 = arg_4(arg_1)

        # Make the setter.
        arg_5 = arg_0._make_setter(arg_0.path.split('.')[-1], arg_1.__class__)

        # Apply the setter now.
        arg_5(arg_1, arg_2)

        # Replace this function with the constructed setter.
        def setter(arg_1, arg_2):
            arg_5(arg_4(arg_1), arg_2)

        arg_0.set = setter