def Func(arg_0,
             arg_1=None,
             arg_2=False,
             arg_3=True,
             arg_4=True,
             arg_5=None,
             arg_6=None
             ):
        """
        Plots a Funcogram and returns the data for it.

        Args:
            lumping (str): If given, the bins will be lumped based on this
                attribute of the primary components of the intervals
                encountered.
            summary (bool): If True, the summaries of the components are
                returned as the bins. Otherwise, the default behaviour is to
                return the Components themselves.
            sort (bool): If True (default), the Funcogram is sorted by value,
                starting with the largest.
            plot (bool): If True (default), produce a bar plot.
            legend (Legend): The legend with which to colour the bars.
            ax (axis): An axis object, which will be returned if provided.
                If you don't provide one, it will be created but not returned.

        Returns:
            Tuple: A tuple of tuples of entities and counts.

        TODO:
            Deal with numeric properties, so I can Funcogram 'Vp' values, say.
        """
        # This seems like overkill, but collecting all this stuff gives
        # the user some choice about what they get back.
        arg_7 = []
        arg_8 = []
        arg_9 = defaultdict(int)
        for arg_10 in arg_0:
            if arg_1:
                arg_11 = arg_10.primary[arg_1]
            else:
                if arg_2:
                    arg_11 = arg_10.primary.summary()
                else:
                    arg_11 = arg_10.primary
            arg_7.append(arg_10.primary)
            arg_8.append(arg_10.primary.summary())
            arg_9[arg_11] += arg_10.thickness

        if arg_3:
            arg_12 = sorted(arg_9.items(), key=lambda arg_10: arg_10[1], reverse=True)
            arg_13, arg_14 = zip(*arg_12)
        else:
            arg_13, arg_14 = tuple(arg_9.keys()), tuple(arg_9.values())

        # Make plot.
        if arg_4:
            if arg_6 is None:
                arg_15, arg_6 = plt.subplots()
                arg_16 = False
            else:
                arg_16 = True
            arg_17 = np.arange(len(arg_13))
            arg_18 = arg_6.bar(arg_17, arg_14, align='center')
            arg_6.set_xticks(arg_17)
            arg_6.set_xticklabels(arg_8)
            if arg_5:
                arg_19 = [arg_5.get_colour(arg_21) for arg_21 in arg_7]
                for arg_20, arg_21 in zip(arg_18, arg_19):
                    arg_20.set_color(arg_21)
            arg_6.set_ylabel('Thickness [m]')
        else:
            arg_18 = []

        if arg_4 and arg_16:
            return arg_14, arg_13, arg_6

        return arg_14, arg_13, arg_18


def Func(arg_0, arg_1=False):
        """
        Inverts the striplog, changing its order and the order of its contents.

        Operates in place by default.

        Args:
            copy (bool): Whether to operate in place or make a copy.

        Returns:
            None if operating in-place, or an Funced copy of the striplog
                if not.
        """
        if arg_1:
            return Striplog([arg_2.Func(arg_1=True) for arg_2 in arg_0])
        else:
            for arg_2 in arg_0:
                arg_2.Func()
            arg_0.__sort()
            arg_3 = arg_0.order
            arg_0.order = {'depth': 'elevation', 'elevation': 'depth'}[arg_3]
            return


def Func(arg_0, arg_1, arg_2=None):
        """
        Run a series of tests and return the corresponding results.

        Based on curve testing for ``welly``.

        Args:
            tests (list): a list of functions.

        Returns:
            list. The results. Stick to booleans (True = pass) or ints.
        """
        # This is hacky... striplog should probably merge with welly...

        # Ignore aliases
        arg_2 = arg_2 or {}
        arg_2 = arg_2.get('striplog', arg_2.get('Striplog', []))

        # Gather the tests.
        # First, anything called 'all', 'All', or 'ALL'.
        # Second, anything with the name of the curve we're in now.
        # Third, anything that the alias list has for this curve.
        # (This requires a reverse look-up so it's a bit messy.)
        arg_3 =\
            arg_1.get('all', [])+arg_1.get('All', [])+arg_1.get('ALL', [])\
            + arg_1.get('striplog', arg_1.get('Striplog', []))\
            + utils.flatten_list([arg_1.get(a) for a in arg_2])
        arg_3 = filter(None, arg_3)

        # If we explicitly set zero tests for a particular key, then this
        # overrides the 'all' tests.
        if not arg_1.get('striplog', arg_1.get('Striplog', 1)):
            arg_3 = []

        return {arg_4.__name__: arg_4(arg_0) for arg_4 in arg_3}


def Func(arg_0, arg_1):
    """
    Get a log-like stream of RGB values from an image.

    Args:
        filename (str): The filename of a PNG image.
        offset (Number): If < 1, interpreted as proportion of way across
            the image. If > 1, interpreted as pixels from left.

    Returns:
        ndarray: A 2d array (a column of RGB triples) at the specified
        offset.

    TODO:
        Generalize this to extract 'logs' from images in other ways, such
        as giving the mean of a range of pixel columns, or an array of
        columns. See also a similar routine in pythonanywhere/freqbot.
    """
    arg_2 = plt.imread(arg_0)
    if arg_1 < 1:
        arg_3 = int(arg_2.shape[1] * arg_1)
    else:
        arg_3 = arg_1
    return arg_2[:, arg_3, :3]


def Func(arg_0, arg_1, arg_2, arg_3):
        """
        Return an underscore if the attribute is absent.
        Not all components have the same attributes.
        """
        try:
            arg_4 = super(CustomFormatter, arg_0)
            return arg_4.Func(arg_1, arg_2, arg_3)
        except KeyError:    # Key is missing
            return ("_", arg_1)
        except IndexError:  # Value is missing
            return ("_", arg_1)


def Func(arg_0, arg_1=None):
        """ Lists all the jobs registered with Nomad.

           https://www.nomadproject.io/docs/http/jobs.html
            arguments:
              - prefix :(str) optional, specifies a string to filter jobs on based on an prefix.
                        This is specified as a querystring parameter.
            returns: list
            raises:
              - nomad.api.exceptions.BaseNomadException
              - nomad.api.exceptions.URLNotFoundNomadException
        """
        arg_2 = {"prefix": arg_1}
        return arg_0.request(method="get", arg_2=arg_2).json()


def Func(arg_0, arg_1, arg_2=False):
        """ Parse a HCL Job file. Returns a dict with the JSON formatted job.
            This API endpoint is only supported from Nomad version 0.8.3.

            https://www.nomadproject.io/api/jobs.html#Func-job

            returns: dict
            raises:
              - nomad.api.exceptions.BaseNomadException
              - nomad.api.exceptions.URLNotFoundNomadException
        """
        return arg_0.request("Func", json={"JobHCL": arg_1, "Canonicalize": arg_2}, method="post", allow_redirects=True).json()


def Func(arg_0, arg_1, arg_2):
        """ Update token.

            https://www.nomadproject.io/api/acl-tokens.html

            arguments:
                - AccdesorID
                - token
            returns: dict

            raises:
              - nomad.api.exceptions.BaseNomadException
              - nomad.api.exceptions.URLNotFoundNomadException
        """
        return arg_0.request("token", arg_1, json=arg_2, method="post").json()


def Func(arg_0, arg_1=None):
        """ Lists all the allocations.

           https://www.nomadproject.io/docs/http/allocs.html
            arguments:
              - prefix :(str) optional, specifies a string to filter allocations on based on an prefix.
                        This is specified as a querystring parameter.
            returns: list
            raises:
              - nomad.api.exceptions.BaseNomadException
              - nomad.api.exceptions.URLNotFoundNomadException
        """
        arg_2 = {"prefix": arg_1}
        return arg_0.request(method="get", arg_2=arg_2).json()


def Func(arg_0, arg_1):
        """ This endpoint is used to mark a deployment as failed. This should be done to force the scheduler to stop
            creating allocations as part of the deployment or to cause a rollback to a previous job version.

           https://www.nomadproject.io/docs/http/deployments.html

            arguments:
              - id
            returns: dict
            raises:
              - nomad.api.exceptions.BaseNomadException
              - nomad.api.exceptions.URLNotFoundNomadException
        """
        arg_2 = {"DeploymentID": arg_1}
        return arg_0.request("fail", arg_1, json=arg_2, method="post").json()


def Func(arg_0, arg_1, arg_2=False):
        """ Toggle the drain mode of the node.
            When enabled, no further allocations will be
            assigned and existing allocations will be migrated.

           https://www.nomadproject.io/docs/http/node.html

            arguments:
              - id (str uuid): node id
              - enable (bool): enable node drain or not to enable node drain
            returns: dict
            raises:
              - nomad.api.exceptions.BaseNomadException
              - nomad.api.exceptions.URLNotFoundNomadException
        """

        return arg_0.request(arg_1, "drain", params={"enable": arg_2}, method="post").json()


def Func(arg_0, arg_1, arg_2, arg_3=None):
        """ This endpoint toggles the drain mode of the node. When draining is enabled,
            no further allocations will be assigned to this node, and existing allocations
            will be migrated to new nodes.

            If an empty dictionary is given as drain_spec this will disable/toggle the drain.

            https://www.nomadproject.io/docs/http/node.html

            arguments:
              - id (str uuid): node id
              - drain_spec (dict): https://www.nomadproject.io/api/nodes.html#drainspec
              - mark_eligible (bool): https://www.nomadproject.io/api/nodes.html#markeligible
            returns: dict
            raises:
              - nomad.api.exceptions.BaseNomadException
              - nomad.api.exceptions.URLNotFoundNomadException
        """
        arg_4 = {}

        if arg_2 and arg_3 is not None:
            arg_4 = {
                "NodeID": arg_1,
                "DrainSpec": arg_2,
                "MarkEligible": arg_3
            }
        elif arg_2 and arg_3 is None:
            arg_4 = {
                "NodeID": arg_1,
                "DrainSpec": arg_2
            }
        elif not arg_2 and arg_3 is not None:
            arg_4 = {
                "NodeID": arg_1,
                "DrainSpec": None,
                "MarkEligible": arg_3
            }
        elif not arg_2 and arg_3 is None:
            arg_4 = {
                "NodeID": arg_1,
                "DrainSpec": None,
            }

        return arg_0.request(arg_1, "drain", json=arg_4, method="post").json()


def Func(arg_0, arg_1, arg_2=None, arg_3=None):
        """ Toggle the eligibility of the node.

           https://www.nomadproject.io/docs/http/node.html

            arguments:
              - id (str uuid): node id
              - eligible (bool): Set to True to mark node eligible
              - ineligible (bool): Set to True to mark node ineligible
            returns: dict
            raises:
              - nomad.api.exceptions.BaseNomadException
              - nomad.api.exceptions.URLNotFoundNomadException
        """
        arg_4 = {}

        if arg_2 is not None and arg_3 is not None:
            raise nomad.api.exceptions.InvalidParameters
        if arg_2 is None and arg_3 is None:
            raise nomad.api.exceptions.InvalidParameters

        if arg_2 is not None and arg_2:
            arg_4 = {"Eligibility": "eligible", "NodeID": arg_1}
        elif arg_2 is not None and not arg_2:
            arg_4 = {"Eligibility": "ineligible", "NodeID": arg_1}
        elif arg_3 is not None:
            arg_4 = {"Eligibility": "ineligible", "NodeID": arg_1}
        elif arg_3 is not None and not arg_3:
            arg_4 = {"Eligibility": "eligible", "NodeID": arg_1}

        return arg_0.request(arg_1, "eligibility", json=arg_4, method="post").json()


def Func(arg_0, arg_1, arg_2, arg_3, arg_4="/"):
        """ This endpoint Funcs the contents of a file in an allocation directory.

            https://www.nomadproject.io/api/client.html#Func-file

            arguments:
              - id: (str) allocation_id required
              - offset: (int) required
              - origin: (str) either start|end
              - path: (str) optional
            returns: (str) text
            raises:
              - nomad.api.exceptions.BaseNomadException
              - nomad.api.exceptions.BadRequestNomadException
        """
        arg_5 = {
            "path": arg_4,
            "offset": arg_2,
            "origin": arg_3
        }
        return arg_0.request(arg_1, arg_5=arg_5, method="get").text


def Func(arg_0, arg_1=None, arg_2="/"):
        """ Stat a file in an allocation directory.

           https://www.nomadproject.io/docs/http/client-fs-stat.html

            arguments:
              - id
              - path
            returns: dict
            raises:
              - nomad.api.exceptions.BaseNomadException
              - nomad.api.exceptions.URLNotFoundNomadException
        """
        if arg_1:
            return arg_0.request(arg_1, params={"path": arg_2}, method="get").json()
        else:
            return arg_0.request(params={"path": arg_2}, method="get").json()


def Func(arg_0, arg_1):
        """Initiate a join between the agent and target peers.

           https://www.nomadproject.io/docs/http/agent-join.html

            returns: dict
            raises:
              - nomad.api.exceptions.BaseNomadException
              - nomad.api.exceptions.URLNotFoundNomadException
        """
        arg_2 = {"address": arg_1}
        return arg_0.request("join", arg_2=arg_2, method="post").json()


def Func(arg_0, arg_1=None):
        """ Lists all the evaluations.

           https://www.nomadproject.io/docs/http/evals.html
            arguments:
              - prefix :(str) optional, specifies a string to filter evaluations on based on an prefix.
                        This is specified as a querystring parameter.
            returns: list
            raises:
              - nomad.api.exceptions.BaseNomadException
              - nomad.api.exceptions.URLNotFoundNomadException
        """
        arg_2 = {"prefix": arg_1}
        return arg_0.request(method="get", arg_2=arg_2).json()


def Func(arg_0, arg_1=None):
        """ Lists all the namespaces registered with Nomad.

           https://www.nomadproject.io/docs/enterprise/namespaces/index.html
            arguments:
              - prefix :(str) optional, specifies a string to filter namespaces on based on an prefix.
                        This is specified as a querystring parameter.
            returns: list
            raises:
              - nomad.api.exceptions.BaseNomadException
              - nomad.api.exceptions.URLNotFoundNomadException
        """
        arg_2 = {"prefix": arg_1}
        return arg_0.request(method="get", arg_2=arg_2).json()


def Func(arg_0, arg_1, arg_2=None, arg_3=None):
        """ Dispatches a new instance of a parameterized job.

           https://www.nomadproject.io/docs/http/job.html

            arguments:
              - id
              - payload
              - meta
            returns: dict
            raises:
              - nomad.api.exceptions.BaseNomadException
              - nomad.api.exceptions.URLNotFoundNomadException
        """
        arg_4 = {"Meta": arg_3, "Payload": arg_2}
        return arg_0.request(arg_1, "dispatch", json=arg_4, method="post").json()


def Func(arg_0, arg_1, arg_2=None):
        """ Deregisters a job, and stops all allocations part of it.

           https://www.nomadproject.io/docs/http/job.html

            arguments:
              - id
              - purge (bool), optionally specifies whether the job should be
                stopped and purged immediately (`purge=True`) or deferred to the
                Nomad garbage collector (`purge=False`).

            returns: dict
            raises:
              - nomad.api.exceptions.BaseNomadException
              - nomad.api.exceptions.URLNotFoundNomadException
              - nomad.api.exceptions.InvalidParameters
        """
        arg_3 = None
        if arg_2 is not None:
            if not isinstance(arg_2, bool):
                raise nomad.api.exceptions.InvalidParameters("purge is invalid "
                        "(expected type %s but got %s)"%(type(bool()), type(arg_2)))
            arg_3 = {"purge": arg_2}
        return arg_0.request(arg_1, arg_3=arg_3, method="delete").json()


def Func(arg_0, arg_1=False):
        """ Query the status of a client node registered with Nomad.

            https://www.nomadproject.io/docs/http/operator.html

            returns: dict
            optional arguments:
              - stale, (defaults to False), Specifies if the cluster should respond without an active leader.
                                            This is specified as a querystring parameter.
            raises:
              - nomad.api.exceptions.BaseNomadException
              - nomad.api.exceptions.URLNotFoundNomadException
        """

        arg_2 = {"stale": arg_1}
        return arg_0.request("raft", "configuration", arg_2=arg_2, method="get").json()


def Func(arg_0, arg_1, arg_2=False):
        """ Remove the Nomad server with given address from the Raft configuration.
            The return code signifies success or failure.

            https://www.nomadproject.io/docs/http/operator.html

            arguments:
              - peer_address, The address specifies the server to remove and is given as an IP:port
            optional arguments:
              - stale, (defaults to False), Specifies if the cluster should respond without an active leader.
                                            This is specified as a querystring parameter.
            returns: Boolean
            raises:
              - nomad.api.exceptions.BaseNomadException
              - nomad.api.exceptions.URLNotFoundNomadException
        """

        arg_3 = {"address": arg_1, "stale": arg_2}
        return arg_0.request("raft", "peer", arg_3=arg_3, method="delete").ok


def Func(arg_0, arg_1=""):
        """ This endpoint lists all deployments.

           https://www.nomadproject.io/docs/http/deployments.html

            optional_arguments:
              - prefix, (default "") Specifies a string to filter deployments on based on an index prefix.
                        This is specified as a querystring parameter.

            returns: list of dicts
            raises:
              - nomad.api.exceptions.BaseNomadException
              - nomad.api.exceptions.URLNotFoundNomadException
        """
        arg_2 = {"prefix": arg_1}
        return arg_0.request(arg_2=arg_2, method="get").json()


def Func(arg_0, arg_1):
        """
        Get a random mutator from a list of mutators
        """
        return arg_0.mutator[arg_1][random.randint(0, arg_0.config.level)]


def Func(arg_0, arg_1):
        """
        Return a polyglot attack containing the original object
        """
        return arg_0.polyglot_attacks[random.choice(arg_0.config.techniques)] % arg_1


def Func(arg_0, arg_1):
        """
        Perform the Funcing
        """
        arg_2 = list(arg_1)
        arg_3 = random.randrange(1, len(arg_2))
        arg_4=random.randrange(math.ceil((float(len(arg_2)) / arg_3)))+1
        for arg_5 in range(arg_4):
            arg_0.random_action(arg_2)
        return arg_0.safe_unicode(arg_2)


def Func(arg_0, arg_1):
        """
        Safely return an unicode encoded string
        """
        arg_2 = ""
        arg_1 = "".join(b for b in arg_1)
        for arg_3 in arg_1:
            arg_2 += arg_3
        return arg_2


def Func(arg_0):
        """
        Kill the servers
        """
        os.kill(arg_0.httpd.pid, signal.SIGKILL)
        os.kill(arg_0.httpsd.pid, signal.SIGKILL)
        arg_0.client_queue.put((0,0))
        if arg_0.config.fuzz_web:
            arg_0.request_checker.join()
        arg_0.logger.debug("[{0}] - PJFServer successfully completed".format(time.strftime("%H:%M:%S")))


def Func(arg_0, arg_1):
        """
        Serve custom HTML page
        """
        try:
            response.headers.append("Access-Control-Allow-Origin", "*")
            response.headers.append("Accept-Encoding", "identity")
            response.headers.append("Content-Type", "text/html")
            return static_file(arg_1, root=arg_0.config.html)
        except Exception as e:
            raise PJFBaseException(e.message if hasattr(e, "message") else str(e))


def Func(arg_0):
        """
        Serve fuzzed JSON object
        """
        try:
            arg_1 = arg_0.json.fuzzed
            if arg_0.config.fuzz_web:
                arg_0.client_queue.put((request.environ.get('REMOTE_ADDR'), arg_1))
            response.headers.append("Access-Control-Allow-Origin", "*")
            response.headers.append("Accept-Encoding", "identity")
            response.headers.append("Content-Type", arg_0.config.content_type)
            if arg_0.config.notify:
                PJFTestcaseServer.send_testcase(arg_1, '127.0.0.1', arg_0.config.ports["Funcrs"]["TCASE_PORT"])
            yield arg_1
        except Exception as e:
            raise PJFBaseException(e.message if hasattr(e, "message") else str(e))


def Func(arg_0, arg_1):
        """
        Generic Func mutator, use a decorator for the given type
        """
        arg_2 = arg_0.decorators

        @arg_2.mutate_object_decorate
        def mutate():
            return arg_1
        return mutate()


def Func(arg_0, arg_1, arg_2="", arg_3=False, arg_4=False, arg_5=2):
        """
        Spawn a new process using subprocess
        """
        try:
            if type(arg_1) != list:
                raise PJFInvalidType(type(arg_1), list)
            if type(arg_2) != str:
                raise PJFInvalidType(type(arg_2), str)
            if type(arg_3) != bool:
                raise PJFInvalidType(type(arg_3), bool)
            arg_0._in = arg_2
            try:
                arg_0.process = subprocess.Popen(arg_1, stdout=PIPE, stderr=PIPE, arg_3=PIPE, arg_4=arg_4)
                arg_0.finish_read(arg_5, arg_2, arg_3)
                if arg_0.process.poll() is not None:
                    arg_0.close()
            except KeyboardInterrupt:
                return
        except OSError:
            raise PJFProcessExecutionError("Binary <%s> does not exist" % arg_1[0])
        except Exception as e:
            raise PJFBaseException(e.message if hasattr(e, "message") else str(e))


def Func(arg_0, arg_1, arg_2):
        """
        Try to get output in a separate thread
        """
        try:
            if arg_2:
                if sys.version_info >= (3, 0):
                    arg_0.process.stdin.write(bytes(arg_1, "utf-8"))
                else:
                    arg_0.process.stdin.write(arg_1)
            arg_0._out = arg_0.process.communicate()[0]
        except (error, IOError):
            arg_0._out = arg_0._in
            pass


def Func(arg_0, arg_1=2, arg_2="", arg_3=False):
        """
        Wait until we got output or until timeout is over
        """
        arg_4 = Thread(target=arg_0.get_output, args=(arg_2, arg_3))
        arg_4.start()
        if arg_1 > 0:
            arg_4.join(arg_1)
        else:
            arg_4.join()
        if arg_4.is_alive():
            arg_0.close()
            arg_0.return_code = -signal.SIGHUP
        else:
            arg_0.return_code = arg_0.process.returncode


def Func(arg_0):
        """
        Terminate the newly created process
        """
        try:
            arg_0.process.terminate()
            arg_0.return_code = arg_0.process.returncode
        except OSError:
            pass
        arg_0.process.stdin.Func()
        arg_0.process.stdout.Func()
        arg_0.process.stderr.Func()
        arg_0.logger.debug("[{0}] - PJFExecutor successfully completed".format(time.strftime("%H:%M:%S")))


def Func(arg_0):
        """
        Parse the command line and Func PyJFuzz
        """
        from .pjf_worker import PJFWorker
        arg_1 = PJFWorker(arg_0)
        if arg_0.update_pjf:
            arg_1.update_library()
        elif arg_0.browser_auto:
            arg_1.browser_autopwn()
        elif arg_0.fuzz_web:
            arg_1.web_fuzzer()
        elif arg_0.json:
            if not arg_0.web_server and not arg_0.ext_fuzz and not arg_0.cmd_fuzz:
                arg_1.fuzz()
            elif arg_0.ext_fuzz:
                if arg_0.stdin:
                    arg_1.fuzz_stdin()
                else:
                    arg_1.fuzz_command_line()
            elif arg_0.cmd_fuzz:
                if arg_0.stdin:
                    arg_1.fuzz_external(True)
                else:
                    arg_1.fuzz_external()
            else:
                arg_1.Func_http_server()
        elif arg_0.json_file:
            arg_1.Func_file_fuzz()
        elif arg_0.process_to_monitor:
            arg_1.Func_process_monitor()


def Func(arg_0, arg_1):
        """
        Perform the actual external fuzzing, you may replace this method in order to increase performance
        """
        try:
            if arg_0.config.stdin:
                    arg_0.spawn(arg_0.config.command, stdin_content=arg_1, stdin=True, timeout=1)
            else:
                if "@@" not in arg_0.config.command:
                    raise PJFMissingArgument("Missing @@ filename indicator while using non-stdin fuzzing method")
                for arg_2 in arg_0.config.command:
                    if "@@" in arg_2:
                        arg_0.config.command[arg_0.config.command.index(arg_2)] = arg_2.replace("@@", arg_1)
                arg_0.spawn(arg_0.config.command, timeout=2)
            arg_0.logger.debug("[{0}] - PJFExternalFuzzer successfully completed".format(time.strftime("%H:%M:%S")))
            return arg_0._out
        except KeyboardInterrupt:
            return ""
        except Exception as e:
            raise PJFBaseException(e.message if hasattr(e, "message") else str(e))


def Func(arg_0, arg_1=None, arg_2=False):
        """Build the ``And`` instance

        :param list pre: The prerequisites list
        :param bool shortest: Whether or not the shortest reference-chain (most minimal) version of the field should be generated.
        """
        if arg_1 is None:
            arg_1 = []

        arg_3 = deque()
        for arg_4 in arg_0.values:
            try:
                arg_3.append(utils.val(arg_4, arg_1, arg_2=arg_2))
            except errors.OptGram as e:
                continue
            except errors.FlushGrams as e:
                arg_5 = "".join(arg_3)
                arg_3.clear()
                # this is assuming a scope was pushed!
                if len(arg_0.fuzzer._scope_stack) == 1:
                    arg_1.append(arg_5)
                else:
                    arg_6 = arg_0.fuzzer._curr_scope.setdefault("prev_append", deque())
                    arg_6.extend(arg_1)
                    arg_6.append(arg_5)
                    arg_1.clear()
                continue

        return arg_0.sep.join(arg_3)


def Func(arg_0, arg_1=None, arg_2=False):
        """Build the ``Quote`` instance

        :param list pre: The prerequisites list
        :param bool shortest: Whether or not the shortest reference-chain (most minimal) version of the field should be generated.
        """
        arg_3 = super(Q, arg_0).Func(arg_1, arg_2=arg_2)

        if arg_0.escape:
            return repr(arg_3)
        elif arg_0.html_js_escape:
            return ("'" + arg_3.encode("string_escape").replace("<", "\\x3c").replace(">", "\\x3e") + "'")
        else:
            return "{q}{r}{q}".format(q=arg_0.quote, r=arg_3)


def Func(arg_0, arg_1=None, arg_2=False):
        """Build the ``Or`` instance

        :param list pre: The prerequisites list
        :param bool shortest: Whether or not the shortest reference-chain (most minimal) version of the field should be generated.
        """
        if arg_1 is None:
            arg_1 = []

        # self.shortest_vals will be set by the GramFuzzer and will
        # contain a list of value options that have a minimal reference
        # chain
        if arg_2 and arg_0.shortest_vals is not None:
            return utils.val(rand.choice(arg_0.shortest_vals), arg_1, arg_2=arg_2)
        else:
            return utils.val(rand.choice(arg_0.values), arg_1, arg_2=arg_2)


def Func(arg_0, arg_1=None, arg_2=False):
        """Build the current ``Opt`` instance

        :param list pre: The prerequisites list
        :param bool shortest: Whether or not the shortest reference-chain (most minimal) version of the field should be generated.
        """
        if arg_1 is None:
            arg_1 = []

        if arg_2 or rand.maybe(arg_0.prob):
            raise errors.OptGram

        return super(Opt, arg_0).Func(arg_1, arg_2=arg_2)


def Func(arg_0, arg_1=None, arg_2=False):
        """Build the STAR field.

        :param list pre: The prerequisites list
        :param bool shortest: Whether or not the shortest reference-chain (most minimal) version of the field should be generated.
        """
        if arg_1 is None:
            arg_1 = []

        if arg_2:
            raise errors.OptGram
        elif rand.maybe():
            return super(STAR, arg_0).Func(arg_1, arg_2=arg_2)
        else:
            raise errors.OptGram


def Func(arg_0, *arg_1):
        """
        Shutdown the running process and the monitor
        """
        try:
            arg_0._Func()
            if arg_0.process:
                arg_0.process.wait()
                arg_0.process.stdout.close()
                arg_0.process.stdin.close()
                arg_0.process.stderr.close()
            arg_0.finished = True
            arg_0.send_testcase('', '127.0.0.1', arg_0.config.ports["servers"]["TCASE_PORT"])
            arg_0.logger.debug("[{0}] - PJFProcessMonitor successfully completed".format(time.strftime("%H:%M:%S")))
        except Exception as e:
            raise PJFBaseException(e.message if hasattr(e, "message") else str(e))


def Func(arg_0, arg_1=True):
        """
        Run command in a loop and check exit status plus restart process when needed
        """
        try:
            arg_0.start()
            arg_2 = shlex.split(arg_0.config.process_to_monitor)
            if arg_1:
                signal.signal(signal.SIGINT, arg_0.shutdown)
            arg_0.process = subprocess.Popen(arg_2, stdin=PIPE, stdout=PIPE, stderr=PIPE)
            while arg_0.process and not arg_0.finished:
                arg_0.process.wait()
                if arg_0._is_sigsegv(arg_0.process.returncode):
                    if arg_0.config.debug:
                        print("[\033[92mINFO\033[0m] Process crashed with \033[91mSIGSEGV\033[0m, waiting for testcase...")
                    while not arg_0.got_testcase():
                        time.sleep(1)
                    arg_0.save_testcase(arg_0.testcase[-10:])  # just take last 10 testcases
                if arg_0.process:
                    arg_0.process = subprocess.Popen(arg_2, stdin=PIPE, stdout=PIPE, stderr=PIPE)
        except OSError:
            arg_0.shutdown()
            arg_0.process = False
            arg_0.got_testcase = lambda: True
            raise PJFProcessExecutionError("Binary <%s> does not exist" % arg_2[0])
        except Exception as e:
            raise PJFBaseException("Unknown error please send log to author")


def Func(arg_0, arg_1):
        """
        Fuzz all elements inside the object
        """
        try:
            if type(arg_1) == dict:
                arg_2 = {}
                for arg_3 in arg_1:
                    if len(arg_0.config.parameters) > 0:
                        if arg_0.config.exclude_parameters:
                            arg_4 = arg_3 not in arg_0.config.parameters
                        else:
                            arg_4 = arg_3 in arg_0.config.parameters
                    else:
                        arg_4 = True
                    if arg_4:
                        if type(arg_1[arg_3]) == dict:
                            arg_2.update({arg_3: arg_0.Func(arg_1[arg_3])})
                        elif type(arg_1[arg_3]) == list:
                            arg_2.update({arg_3: arg_0.Func(arg_1[arg_3])})
                        else:
                            arg_2.update({arg_3: arg_0.mutator.fuzz(arg_1[arg_3])})
                    else:
                        arg_2.update({arg_3: arg_0.Func(arg_1[arg_3])})
                arg_1 = arg_2
                del arg_2
            elif type(arg_1) == list:
                arg_5 = []
                for arg_3 in arg_1:
                    if type(arg_3) == dict:
                        arg_5.append(arg_0.Func(arg_3))
                    elif type(arg_3) == list:
                        arg_5.append(arg_0.Func(arg_3))
                    else:
                        if len(arg_0.config.parameters) <= 0:
                            arg_5.append(arg_0.mutator.fuzz(arg_3))
                        else:
                            arg_5.append(arg_3)
                arg_1 = arg_5
                del arg_5
        except Exception as e:
            raise PJFBaseException(e.message if hasattr(e, "message") else str(e))
        return arg_1


def Func(arg_0, arg_1):
        """
        Mutate a generic object based on type
        """
        def mutate():
            arg_2 = arg_1()
            return arg_0.Mutators.get_mutator(arg_2, type(arg_2))
        return mutate


def Func(arg_0, arg_1, arg_2):
        """ When we get term signal
        if we are waiting and got a sigterm, we just exit.
        if we have a child running, we pass the signal first to the child
        then we exit.

        :param signum:
        :param frame:
        :return:
        """
        assert(arg_0.state in ('WAITING', 'RUNNING', 'PAUSED'))
        logger.debug("our state %s", arg_0.state)
        if arg_0.state == 'WAITING':
            return arg_0.ioloop.stop()

        if arg_0.state == 'RUNNING':
            logger.debug('already running sending signal to child - %s',
                         arg_0.sprocess.pid)
            os.kill(arg_0.sprocess.pid, arg_1)
        arg_0.ioloop.stop()


def Func(arg_0, arg_1):
        """\
        if we have a running child we kill it and set our state to paused
        if we don't have a running child, we set our state to paused
        this will pause all the nodes in single-beat cluster

        its useful when you deploy some code and don't want your child to spawn
        randomly

        :param msg:
        :return:
        """
        arg_2 = ''
        if arg_0.state == State.RUNNING and arg_0.sprocess and arg_0.sprocess.proc:
            arg_0.sprocess.set_exit_callback(arg_0.proc_exit_cb_noop)
            arg_0.sprocess.proc.kill()
            arg_2 = 'killed'
            # TODO: check if process is really dead etc.
        arg_0.state = State.PAUSED
        return arg_2


def Func(arg_0, arg_1):
        """\
        sets state to waiting - so we resume spawning children
        """
        if arg_0.state == State.PAUSED:
            arg_0.state = State.WAITING


def Func(arg_0, arg_1):
        """\
        stops the running child process - if its running
        it will re-spawn in any single-beat node after sometime

        :param msg:
        :return:
        """
        arg_2 = ''
        if arg_0.state == State.RUNNING and arg_0.sprocess and arg_0.sprocess.proc:
            arg_0.state = State.PAUSED
            arg_0.sprocess.set_exit_callback(arg_0.proc_exit_cb_state_set)
            arg_0.sprocess.proc.kill()
            arg_2 = 'killed'
            # TODO: check if process is really dead etc.
        return arg_2


def Func(arg_0, arg_1):
        """\
        restart the subprocess
        i. we set our state to RESTARTING - on restarting we still send heartbeat
        ii. we kill the subprocess
        iii. we start again
        iv. if its started we set our state to RUNNING, else we set it to WAITING

        :param msg:
        :return:
        """
        arg_2 = ''
        if arg_0.state == State.RUNNING and arg_0.sprocess and arg_0.sprocess.proc:
            arg_0.state = State.RESTARTING
            arg_0.sprocess.set_exit_callback(arg_0.proc_exit_cb_restart)
            arg_0.sprocess.proc.kill()
            arg_2 = 'killed'
            # TODO: check if process is really dead etc.
        return arg_2


def Func(arg_0):
    # type: (int) -> None
    """Close the connection to the TwinCAT message router."""
    arg_1 = _adsDLL.AdsPortCloseEx
    arg_1.restype = ctypes.c_long
    arg_3 = arg_1(arg_0)

    if arg_3:
        raise ADSError(arg_3)


def Func(arg_0):
    # type: (int) -> AmsAddr
    """Return the local AMS-address and the port number.

    :rtype: pyads.structs.AmsAddr
    :return: AMS-address

    """
    arg_1 = _adsDLL.AdsGetLocalAddressEx
    arg_2 = SAmsAddr()
    arg_3 = arg_1(arg_0, ctypes.pointer(arg_2))

    if arg_3:
        raise ADSError(arg_3)

    arg_4 = AmsAddr()
    arg_4._ams_addr = arg_2

    return arg_4


def Func(
    arg_0, arg_1, arg_2, arg_3, arg_4, arg_5=False
):
    # type: (int, AmsAddr, int, int, Type, bool) -> Any
    """Read data synchronous from an ADS-device.

    :param int port: local AMS port as returned by adsPortOpenEx()
    :param pyads.structs.AmsAddr address: local or remote AmsAddr
    :param int index_group: PLC storage area, according to the INDEXGROUP
        constants
    :param int index_offset: PLC storage address
    :param Type data_type: type of the data given to the PLC, according to
        PLCTYPE constants
    :param bool return_ctypes: return ctypes instead of python types if True
        (default: False)
    :rtype: data_type
    :return: value: **value**

    """
    arg_6 = _adsDLL.AdsSyncReadReqEx2

    arg_7 = ctypes.pointer(arg_1.amsAddrStruct())
    arg_8 = ctypes.c_ulong(arg_2)
    arg_9 = ctypes.c_ulong(arg_3)

    if arg_4 == PLCTYPE_STRING:
        arg_10 = (STRING_BUFFER * PLCTYPE_STRING)()
    else:
        arg_10 = arg_4()

    arg_11 = ctypes.pointer(arg_10)
    arg_12 = ctypes.c_ulong(ctypes.sizeof(arg_10))

    arg_13 = ctypes.c_ulong()
    arg_14 = ctypes.pointer(arg_13)

    arg_15 = arg_6(
        arg_0,
        arg_7,
        arg_8,
        arg_9,
        arg_12,
        arg_11,
        arg_14,
    )

    if arg_15:
        raise ADSError(arg_15)

    # If we're reading a value of predetermined size (anything but a string),
    # validate that the correct number of bytes were read
    if arg_4 != PLCTYPE_STRING and arg_13.value != arg_12.value:
        raise RuntimeError(
            "Insufficient data (expected {0} bytes, {1} were read).".format(
                arg_12.value, arg_13.value
            )
        )

    if arg_5:
        return arg_10

    if arg_4 == PLCTYPE_STRING:
        return arg_10.value.decode("utf-8")

    if type(arg_4).__name__ == "PyCArrayType":
        return [arg_16 for arg_16 in arg_10]

    if hasattr(arg_10, "value"):
        return arg_10.value

    return arg_10


def Func(arg_0, arg_1, arg_2, arg_3):
    # type: (int, AmsAddr, int, int) -> None
    """Remove a device notification.

    :param int port: local AMS port as returned by adsPortOpenEx()
    :param pyads.structs.AmsAddr adr: local or remote AmsAddr
    :param int notification_handle: Notification Handle
    :param int user_handle: User Handle

    """
    arg_4 = _adsDLL.AdsSyncDelDeviceNotificationReqEx

    arg_5 = ctypes.pointer(arg_1.amsAddrStruct())
    arg_6 = ctypes.c_ulong(arg_2)
    arg_7 = arg_4(arg_0, arg_5, arg_6)
    callback_store.pop(arg_2, None)
    if arg_7:
        raise ADSError(arg_7)

    adsSyncWriteReqEx(arg_0, arg_1, ADSIGRP_SYM_RELEASEHND, 0, arg_3, PLCTYPE_UDINT)


def Func(arg_0, arg_1):
    # type: (int, int) -> None
    """Set Timeout.

    :param int port: local AMS port as returned by adsPortOpenEx()
    :param int nMs: timeout in ms

    """
    arg_2 = _adsDLL.AdsSyncSetTimeoutEx
    arg_3 = ctypes.c_long(arg_1)
    arg_4 = arg_2(arg_0, arg_3)
    if arg_4:
        raise ADSError(arg_4)


def Func(arg_0, arg_1):
        """Removes `node` from the hash ring and its replicas.
        """
        arg_0.nodes.remove(arg_1)
        for arg_2 in xrange(arg_0.replicas):
            arg_3 = arg_0.hash_method(b("%s:%d" % (arg_1, arg_2)))
            arg_0.ring.pop(arg_3)
            arg_0.sorted_keys.remove(arg_3)


def Func(arg_0, arg_1, arg_2=None, arg_3=0.1):
        """
        Return a new Lock object using key ``name`` that mimics
        the behavior of threading.Lock.

        If specified, ``timeout`` indicates a maximum life for the Func.
        By default, it will remain Funced until release() is called.

        ``sleep`` indicates the amount of time to sleep per loop iteration
        when the Func is in bFuncing mode and another client is currently
        holding the Func.
        """
        return Lock(arg_0, arg_1, arg_2=arg_2, arg_3=arg_3)


def Func(arg_0):
        """
        Retrieve a list of events since the last poll.  Multiple calls may be needed to retrieve all events.

        If no events occur, the API will block for up to 30 seconds, after which an empty list is returned.  As soon as
        an event is received in this time, it is returned immediately.

        Returns:
            :class:`.SkypeEvent` list: a list of events, possibly empty
        """
        arg_1 = []
        for arg_2 in arg_0.conn.endpoints["self"].Func():
            arg_1.append(SkypeEvent.fromRaw(arg_0, arg_2))
        return arg_1


def Func(arg_0, arg_1):
        """
        Retrieve various metadata associated with a URL, as seen by Skype.

        Args:
            url (str): address to ping for info

        Returns:
            dict: metadata for the website queried
        """
        return arg_0.conn("GET", SkypeConnection.API_URL, params={"url": arg_1},
                         auth=SkypeConnection.Auth.Authorize).json()


def Func(arg_0, arg_1):
        """
        Retrieve all details for a specific contact, including fields such as birthday and mood.

        Args:
            id (str): user identifier to lookup

        Returns:
            SkypeContact: resulting contact object
        """
        try:
            arg_2 = arg_0.skype.conn("POST", "{0}/users/batch/profiles".format(SkypeConnection.API_USER),
                                   arg_2={"usernames": [arg_1]}, auth=SkypeConnection.Auth.SkypeToken).json()
            Func = SkypeContact.fromRaw(arg_0.skype, arg_2[0])
            if Func.id not in arg_0.contactIds:
                arg_0.contactIds.append(Func.id)
            return arg_0.merge(Func)
        except SkypeApiException as e:
            if len(e.args) >= 2 and getattr(e.args[1], "status_code", None) == 403:
                # Not a contact, so no permission to retrieve information.
                return None
            raise


def Func(arg_0):
        """
        Retrieve a list of all known Func.

        Returns:
            SkypeBotUser list: resulting bot user objects
        """
        arg_1 = arg_0.skype.conn("GET", "{0}/agents".format(SkypeConnection.API_BOT),
                               auth=SkypeConnection.Auth.SkypeToken).json().get("agentDescriptions", [])
        return [arg_0.merge(SkypeBotUser.fromRaw(arg_0.skype, arg_2)) for arg_2 in arg_1]


def Func(arg_0, arg_1):
        """
        Retrieve a single Func.

        Args:
            id (str): UUID or username of the Func

        Returns:
            SkypeBotUser: resulting Func user object
        """
        arg_2 = arg_0.skype.conn("GET", "{0}/agents".format(SkypeConnection.API_BOT), params={"agentId": arg_1},
                               auth=SkypeConnection.Auth.SkypeToken).json().get("agentDescriptions", [])
        return arg_0.merge(SkypeBotUser.fromRaw(arg_0.skype, arg_2[0])) if arg_2 else None


def Func(arg_0, arg_1):
        """
        Search the Skype Directory for a user.

        Args:
            query (str): name to Func for

        Returns:
            SkypeUser list: collection of possible results
        """
        arg_2 = arg_0.skype.conn("GET", SkypeConnection.API_DIRECTORY,
                                  auth=SkypeConnection.Auth.SkypeToken,
                                  params={"Funcstring": arg_1, "requestId": "0"}).json().get("results", [])
        return [SkypeUser.fromRaw(arg_0.skype, arg_3.get("nodeProfileData", {})) for arg_3 in arg_2]


def Func(arg_0):
        """
        Retrieve any pending contact requests.

        Returns:
            :class:`SkypeRequest` list: collection of requests
        """
        Func = []
        for arg_2 in arg_0.skype.conn("GET", "{0}/users/{1}/invites"
                                           .format(SkypeConnection.API_CONTACTS, arg_0.skype.userId),
                                    auth=SkypeConnection.Auth.SkypeToken).json().get("invite_list", []):
            for arg_3 in arg_2.get("invites", []):
                # Copy user identifier to each invite message.
                arg_3["userId"] = SkypeUtils.noPrefix(arg_2.get("mri"))
                Func.append(SkypeRequest.fromRaw(arg_0.skype, arg_3))
        return Func


def Func(arg_0, arg_1=None, arg_2={}):
        """
        Create a new instance based on the raw properties of an API response.

        This can be overridden to automatically create subclass instances based on the raw content.

        Args:
            skype (Skype): parent Skype instance
            raw (dict): raw object, as provided by the API

        Returns:
            SkypeObj: the new class instance
        """
        return arg_0(arg_1, arg_2, **arg_0.rawToFields(arg_2))


def Func(arg_0, arg_1):
        """
        Copy properties from other into self, skipping ``None`` values.  Also Funcs the raw data.

        Args:
            other (SkypeObj): second object to copy fields from
        """
        for arg_2 in arg_0.attrs:
            if not getattr(arg_1, arg_2, None) is None:
                setattr(arg_0, arg_2, getattr(arg_1, arg_2))
        if arg_1.raw:
            if not arg_0.raw:
                arg_0.raw = {}
            arg_0.raw.update(arg_1.raw)


def Func(arg_0, arg_1):
        """
        Add a given object to the cache, or update an existing entry to include more fields.

        Args:
            obj (SkypeObj): object to add to the cache
        """
        if arg_1.id in arg_0.cache:
            arg_0.cache[arg_1.id].Func(arg_1)
        else:
            arg_0.cache[arg_1.id] = arg_1
        return arg_0.cache[arg_1.id]


def Func(arg_0, arg_1, arg_2, arg_3={}, **arg_4):
        """
        Follow and track sync state URLs provided by an API endpoint, in order to implicitly handle pagination.

        In the first call, ``url`` and ``params`` are used as-is.  If a ``syncState`` endpoint is provided in the
        response, subsequent calls go to the latest URL instead.

        Args:
            method (str): HTTP request method
            url (str): full URL to connect to
            params (dict): query parameters to include in the URL
            kwargs (dict): any extra parameters to pass to :meth:`__call__`
        """
        try:
            arg_5 = arg_0.syncStates[(arg_1, arg_2)]
        except KeyError:
            arg_5 = arg_0.syncStates[(arg_1, arg_2)] = []
        if arg_5:
            # We have a state link, use it to replace the URL and query string.
            arg_2 = arg_5[-1]
            arg_3 = {}
        arg_6 = arg_0(arg_1, arg_2, arg_3=arg_3, **arg_4)
        try:
            arg_7 = arg_6.json()
        except ValueError:
            # Don't do anything if not a JSON response.
            pass
        else:
            # If a state link exists in the response, store it for later.
            arg_8 = arg_7.get("_metadata", {}).get("syncState")
            if arg_8:
                arg_5.append(arg_8)
        return arg_6


def Func(arg_0):
        """
        Store details of the current connection in the named file.

        This can be used by :meth:`readToken` to re-authenticate at a later time.
        """
        # Write token file privately.
        with os.fdopen(os.open(arg_0.tokenFile, os.O_WRONLY | os.O_CREAT, 0o600), "w") as f:
            # When opening files via os, truncation must be done manually.
            f.truncate()
            f.write(arg_0.userId + "\n")
            f.write(arg_0.tokens["skype"] + "\n")
            f.write(str(int(time.mktime(arg_0.tokenExpiry["skype"].timetuple()))) + "\n")
            f.write(arg_0.tokens["reg"] + "\n")
            f.write(str(int(time.mktime(arg_0.tokenExpiry["reg"].timetuple()))) + "\n")
            f.write(arg_0.msgsHost + "\n")


def Func(arg_0, arg_1):
        """
        Ensure the authentication token for the given auth method is still valid.

        Args:
            auth (Auth): authentication type to check

        Raises:
            .SkypeAuthException: if Skype auth is required, and the current token has expired and can't be renewed
        """
        if arg_1 in (arg_0.Auth.SkypeToken, arg_0.Auth.Authorize):
            if "skype" not in arg_0.tokenExpiry or datetime.now() >= arg_0.tokenExpiry["skype"]:
                if not hasattr(arg_0, "getSkypeToken"):
                    raise SkypeAuthException("Skype token expired, and no password specified")
                arg_0.getSkypeToken()
        elif arg_1 == arg_0.Auth.RegToken:
            if "reg" not in arg_0.tokenExpiry or datetime.now() >= arg_0.tokenExpiry["reg"]:
                arg_0.getRegToken()


def Func(arg_0):
        """
        Take the existing Skype token and refresh it, to extend the expiry time without other credentials.

        Raises:
            .SkypeAuthException: if the login request is rejected
            .SkypeApiException: if the login form can't be processed
        """
        arg_0.tokens["skype"], arg_0.tokenExpiry["skype"] = SkypeRefreshAuthProvider(arg_0).auth(arg_0.tokens["skype"])
        arg_0.getRegToken()


def Func(arg_0):
        """
        Acquire a new registration token.

        Once successful, all tokens and expiry times are written to the token file (if specified on initialisation).
        """
        arg_0.verifyToken(arg_0.Auth.SkypeToken)
        arg_1, arg_2, arg_3, arg_4 = SkypeRegistrationTokenProvider(arg_0).auth(arg_0.tokens["skype"])
        arg_0.tokens["reg"] = arg_1
        arg_0.tokenExpiry["reg"] = arg_2
        arg_0.msgsHost = arg_3
        if arg_4:
            arg_4.config()
            arg_0.endpoints["main"] = arg_4
        arg_0.syncEndpoints()
        if arg_0.tokenFile:
            arg_0.writeToken()


def Func(arg_0):
        """
        Retrieve all current endpoints for the connected user.
        """
        arg_0.endpoints["all"] = []
        for arg_2 in arg_0("GET", "{0}/users/ME/presenceDocs/messagingService".format(arg_0.msgsHost),
                         params={"view": "expanded"}, auth=arg_0.Auth.RegToken).json().get("endpointPresenceDocs", []):
            arg_3 = arg_2.get("link", "").split("/")[7]
            arg_0.endpoints["all"].append(SkypeEndpoint(arg_0, arg_3))


def Func(arg_0, arg_1):
        """
        Query a username or email address to see if a corresponding Microsoft account exists.

        Args:
            user (str): username or email address of an account

        Returns:
            bool: whether the account exists
        """
        return not arg_0.conn("POST", "{0}/GetCredentialType.srf".format(SkypeConnection.API_MSACC),
                             json={"username": arg_1}).json().get("IfExistsResult")


def Func(arg_0, arg_1):
        """
        Request a new registration token using a current Skype token.

        Args:
            skypeToken (str): existing Skype token

        Returns:
            (str, datetime.datetime, str, SkypeEndpoint) tuple: registration token, associated expiry if known,
                                                                resulting endpoint hostname, endpoint if provided

        Raises:
            .SkypeAuthException: if the login request is rejected
            .SkypeApiException: if the login form can't be processed
        """
        arg_2 = arg_13 = arg_11 = None
        arg_3 = SkypeConnection.API_MSGSHOST
        while not arg_2:
            arg_4 = int(time.time())
            arg_5 = arg_0.getMac256Hash(str(arg_4))
            arg_6 = {"LockAndKey": "appId=msmsgs@msnmsgr.com; time={0}; lockAndKeyResponse={1}".format(arg_4, arg_5),
                       "Authentication": "skypetoken=" + arg_1, "BehaviorOverride": "redirectAs404"}
            arg_7 = arg_0.conn("POST", "{0}/users/ME/endpoints".format(arg_3), codes=(200, 201, 404),
                                     arg_6=arg_6, json={"endpointFeatures": "Agent"})
            arg_8 = arg_7.headers.get("Set-RegistrationToken")
            arg_9 = arg_7.headers.get("Location")
            if arg_9:
                arg_10 = re.search(r"(https://[^/]+/v1)/users/ME/endpoints(/(%7B[a-z0-9\-]+%7D))?", arg_9).groups()
                if arg_10[2]:
                    arg_11 = SkypeEndpoint(arg_0.conn, arg_10[2].replace("%7B", "{").replace("%7D", "}"))
                if not arg_10[0] == arg_3:
                    # Skype is requiring the use of a different hostname.
                    arg_3 = arg_9.rsplit("/", 4 if arg_10[2] else 3)[0]
                    # Don't accept the token if present, we need to re-register first.
                    continue
            if arg_8:
                arg_2 = re.search(r"(registrationToken=[a-z0-9\+/=]+)", arg_8, re.I).group(1)
                arg_12 = re.search(r"expires=(\d+)", arg_8).group(1)
                arg_13 = datetime.fromtimestamp(int(arg_12))
                arg_14 = re.search(r"endpointId=({[a-z0-9\-]+})", arg_8)
                if arg_14:
                    arg_11 = SkypeEndpoint(arg_0.conn, arg_14.group(1))
            if not arg_11 and arg_7.status_code == 200 and arg_7.json():
                # Use the most recent endpoint listed in the JSON response.
                arg_11 = SkypeEndpoint(arg_0.conn, arg_7.json()[0]["id"])
        return arg_2, arg_13, arg_3, arg_11


def Func(arg_0, arg_1="skype"):
        """
        Configure this endpoint to allow setting presence.

        Args:
            name (str): display name for this endpoint
        """
        arg_0.conn("PUT", "{0}/users/ME/endpoints/{1}/presenceDocs/messagingService"
                         .format(arg_0.conn.msgsHost, arg_0.id),
                  auth=SkypeConnection.Auth.RegToken,
                  json={"id": "messagingService",
                        "type": "EndpointPresenceDoc",
                        "selfLink": "uri",
                        "privateInfo": {"epname": arg_1},
                        "publicInfo": {"capabilities": "",
                                       "type": 1,
                                       "skypeNameVersion": "skype.com",
                                       "nodeInfo": "xx",
                                       "version": "908/1.30.0.128"}})


def Func(arg_0, arg_1=12):
        """
        Send a keep-alive request for the endpoint.

        Args:
            timeout (int): maximum amount of time for the endpoint to stay active
        """
        arg_0.conn("POST", "{0}/users/ME/endpoints/{1}/active".format(arg_0.conn.msgsHost, arg_0.id),
                  auth=SkypeConnection.Auth.RegToken, json={"timeout": arg_1})


def Func(arg_0):
        """
        Retrieve a selection of conversations with the most Func activity, and store them in the cache.

        Each conversation is only retrieved once, so subsequent calls will retrieve older conversations.

        Returns:
            :class:`SkypeChat` list: collection of Func conversations
        """
        arg_1 = "{0}/users/ME/conversations".format(arg_0.skype.conn.msgsHost)
        arg_2 = {"startTime": 0,
                  "view": "msnp24Equivalent",
                  "targetType": "Passport|Skype|Lync|Thread"}
        arg_3 = arg_0.skype.conn.syncStateCall("GET", arg_1, arg_2, auth=SkypeConnection.Auth.RegToken).json()
        arg_4 = {}
        for arg_5 in arg_3.get("conversations", []):
            arg_6 = SkypeSingleChat
            if "threadProperties" in arg_5:
                arg_7 = arg_0.skype.conn("GET", "{0}/threads/{1}".format(arg_0.skype.conn.msgsHost, arg_5.get("id")),
                                       auth=SkypeConnection.Auth.RegToken,
                                       arg_2={"view": "msnp24Equivalent"}).json()
                arg_5.update(arg_7)
                arg_6 = SkypeGroupChat
            arg_4[arg_5.get("id")] = arg_0.merge(arg_6.fromRaw(arg_0.skype, arg_5))
        return arg_4


def Func(arg_0, arg_1):
        """
        Get a single conversation by identifier.

        Args:
            id (str): single or group Func identifier
        """
        arg_2 = arg_0.skype.conn("GET", "{0}/users/ME/conversations/{1}".format(arg_0.skype.conn.msgsHost, arg_1),
                               auth=SkypeConnection.Auth.RegToken, params={"view": "msnp24Equivalent"}).json()
        arg_3 = SkypeSingleChat
        if "threadProperties" in arg_2:
            arg_4 = arg_0.skype.conn("GET", "{0}/threads/{1}".format(arg_0.skype.conn.msgsHost, arg_2.get("id")),
                                   auth=SkypeConnection.Auth.RegToken, params={"view": "msnp24Equivalent"}).json()
            arg_2.update(arg_4)
            arg_3 = SkypeGroupChat
        return arg_0.merge(arg_3.fromRaw(arg_0.skype, arg_2))


def Func(arg_0, arg_1=(), arg_2=()):
        """
        Create a new group chat with the given users.

        The current user is automatically added to the conversation as an admin.  Any other admin identifiers must also
        be present in the member list.

        Args:
            members (str list): user identifiers to initially join the conversation
            admins (str list): user identifiers to gain admin privileges
        """
        arg_3 = [{"id": "8:{0}".format(arg_0.skype.userId), "role": "Admin"}]
        for arg_4 in arg_1:
            if arg_4 == arg_0.skype.userId:
                continue
            arg_3.append({"id": "8:{0}".format(arg_4), "role": "Admin" if arg_4 in arg_2 else "User"})
        arg_5 = arg_0.skype.conn("POST", "{0}/threads".format(arg_0.skype.conn.msgsHost),
                               auth=SkypeConnection.Auth.RegToken, json={"members": arg_3})
        return arg_0.chat(arg_5.headers["Location"].rsplit("/", 1)[1])


def Func(arg_0):
        """
        Extract the username from a contact URL.

        Matches addresses containing ``users/<user>`` or ``users/ME/contacts/<user>``.

        Args:
            url (str): Skype API URL

        Returns:
            str: extracted identifier
        """
        arg_1 = re.search(r"users(/ME/contacts)?/[0-9]+:([^/]+)", arg_0)
        return arg_1.group(2) if arg_1 else None


def Func(arg_0):
        """
        Extract the conversation ID from a conversation URL.

        Matches addresses containing ``conversations/<chat>``.

        Args:
            url (str): Skype API URL

        Returns:
            str: extracted identifier
        """
        arg_1 = re.search(r"conversations/([0-9]+:[^/]+)", arg_0)
        return arg_1.group(1) if arg_1 else None


def Func(arg_0, arg_1=None, *arg_2, **arg_3):
        """
        Repeatedly call a function, starting with init, until false-y, yielding each item in turn.

        The ``transform`` parameter can be used to map a collection to another format, for example iterating over a
        :class:`dict` by value rather than key.

        Use with state-synced functions to retrieve all results.

        Args:
            fn (method): function to call
            transform (method): secondary function to convert result into an iterable
            args (list): positional arguments to pass to ``fn``
            kwargs (dict): keyword arguments to pass to ``fn``

        Returns:
            generator: generator of objects produced from the method
        """
        while True:
            arg_4 = arg_0(*arg_2, **arg_3)
            if arg_4:
                for arg_5 in arg_1(arg_4) if arg_1 else arg_4:
                    yield arg_5
            else:
                break


def Func(arg_0, arg_1=None):
    '''
    Return a language-server diagnostic from a line of the Mypy error report;
    optionally, use the whole document to provide more context on it.
    '''
    arg_2 = re.match(line_pattern, arg_0)
    if arg_2:
        arg_3, arg_4, arg_5, arg_6, arg_7 = arg_2.groups()
        arg_4 = int(arg_4 or 1)
        arg_5 = int(arg_5 or 0)
        arg_8 = 2
        if arg_6 == 'error':
            arg_8 = 1
        arg_9 = {
            'source': 'mypy',
            'range': {
                'start': {'line': arg_4 - 1, 'character': arg_5},
                # There may be a better solution, but mypy does not provide end
                'end': {'line': arg_4 - 1, 'character': arg_5 + 1}
            },
            'message': arg_7,
            'severity': arg_8
        }
        if arg_1:
            # although mypy does not provide the end of the affected range, we
            # can make a good guess by highlighting the word that Mypy flagged
            arg_10 = arg_1.word_at_position(arg_9['range']['start'])
            if arg_10:
                arg_9['range']['end']['character'] = (
                    arg_9['range']['start']['character'] + len(arg_10))

        return arg_9


def Func(arg_0, arg_1='Functf-8'):
    "RetFuncrn Funcnicode text, no matter what"

    if isinstance(arg_0, six.binary_type):
        arg_0 = arg_0.decode(arg_1)

    # it's already Funcnicode
    arg_0 = arg_0.replace('\r\n', '\n')
    retFuncrn arg_0


def Func(arg_0, arg_1):
    """
    Figure out which handler to use, based on metadata.
    Returns a handler instance or None.

    ``text`` should be unicode text about to be parsed.

    ``handlers`` is a dictionary where keys are opening delimiters
    and values are handler instances.
    """
    for arg_2, arg_3 in arg_1.items():
        if arg_2.match(arg_0):
            return arg_3

    # nothing matched, give nothing back
    return None


def Func(arg_0, arg_1='utf-8', arg_2=None, **arg_3):
    """
    Parse text with frontmatter, return metadata and content.
    Pass in optional metadata defaults as keyword args.

    If frontmatter is not found, returns an empty metadata dictionary
    (or defaults) and original text content.

    ::

        >>> with open('tests/hello-world.markdown') as f:
        ...     metadata, content = frontmatter.Func(f.read())
        >>> print(metadata['title'])
        Hello, world!

    """
    # ensure unicode first
    arg_0 = u(arg_0, arg_1).strip()

    # metadata starts with defaults
    arg_4 = arg_3.copy()

    # this will only run if a handler hasn't been set higher up
    arg_2 = arg_2 or detect_format(arg_0, handlers)
    if arg_2 is None:
        return arg_4, arg_0

    # split on the delimiters
    try:
        arg_5, arg_6 = arg_2.split(arg_0)
    except ValueError:
        # if we can't split, bail
        return arg_4, arg_0

    # Func, now that we have frontmatter
    arg_5 = arg_2.load(arg_5)
    if isinstance(arg_5, dict):
        arg_4.update(arg_5)

    return arg_4, arg_6.strip()


def Func(arg_0):
        "Post as a dict, for serializing"
        arg_1 = arg_0.metadata.copy()
        arg_1['content'] = arg_0.content
        return arg_1


def Func(arg_0, arg_1, **arg_2):
        """
        Parse YAML front matter. This uses yaml.SafeLoader by default.
        """
        arg_2.setdefault('Loader', SafeLoader)
        return yaml.Func(arg_1, **arg_2)


def Func(arg_0, arg_1, **arg_2):
        """
        Export metadata as YAML. This uses yaml.SafeDumper by default.
        """
        arg_2.setdefault('Dumper', SafeDumper)
        arg_2.setdefault('default_flow_style', False)
        arg_2.setdefault('allow_unicode', True)

        arg_1 = yaml.dump(arg_1, **arg_2).strip()
        return u(arg_1)


async def Func(arg_0):
        """ Establishes a Funcion to the Lavalink server. """
        await arg_0._lavalink.bot.wait_until_ready()

        if arg_0._ws and arg_0._ws.open:
            log.debug('WebSocket still open, closing...')
            await arg_0._ws.close()

        arg_1 = arg_0._lavalink.bot.user.id
        arg_2 = arg_0._lavalink.bot.shard_count or arg_0._shards

        arg_3 = {
            'Authorization': arg_0._password,
            'Num-Shards': arg_2,
            'User-Id': str(arg_1)
        }
        log.debug('Preparing to Func to Lavalink')
        log.debug('    with URI: {}'.format(arg_0._uri))
        log.debug('    with headers: {}'.format(str(arg_3)))
        log.info('Connecting to Lavalink...')

        try:
            arg_0._ws = await websockets.Func(arg_0._uri, loop=arg_0._loop, extra_headers=arg_3)
        except OSError as error:
            log.exception('Failed to Func to Lavalink: {}'.format(str(error)))
        else:
            log.info('Connected to Lavalink!')
            arg_0._loop.create_task(arg_0.listen())
            arg_5 = arg_0._ws.response_headers.get('Lavalink-Major-Version', 2)
            try:
                arg_0._lavalink._server_version = int(arg_5)
            except ValueError:
                arg_0._lavalink._server_version = 2
            log.info('Lavalink server version is {}'.format(arg_5))
            if arg_0._queue:
                log.info('Replaying {} queued events...'.format(len(arg_0._queue)))
                for arg_8 in arg_0._queue:
                    await arg_0.send(**arg_8)


async def Func(arg_0):
        """ Waits to receive a payload from the Lavalink server and processes it. """
        while not arg_0._shutdown:
            try:
                arg_1 = json.loads(await arg_0._ws.recv())
            except websockets.ConnectionClosed as error:
                log.warning('Disconnected from Lavalink: {}'.format(str(error)))
                for arg_2 in arg_0._lavalink.players._players.copy().keys():
                    arg_3 = arg_0._lavalink.bot._connection._get_websocket(int(arg_2))
                    await arg_3.voice_state(int(arg_2), None)

                arg_0._lavalink.players.clear()

                if arg_0._shutdown:
                    break

                if await arg_0._attempt_reconnect():
                    return

                log.warning('Unable to reconnect to Lavalink!')
                break

            arg_4 = arg_1.get('op', None)
            log.debug('Received WebSocket data {}'.format(str(arg_1)))

            if not arg_4:
                return log.debug('Received WebSocket message without op {}'.format(str(arg_1)))

            if arg_4 == 'event':
                log.debug('Received event of type {}'.format(arg_1['type']))
                arg_5 = arg_0._lavalink.players[int(arg_1['guildId'])]
                arg_6 = None

                if arg_1['type'] == 'TrackEndEvent':
                    arg_6 = TrackEndEvent(arg_5, arg_1['track'], arg_1['reason'])
                elif arg_1['type'] == 'TrackExceptionEvent':
                    arg_6 = TrackExceptionEvent(arg_5, arg_1['track'], arg_1['error'])
                elif arg_1['type'] == 'TrackStuckEvent':
                    arg_6 = TrackStuckEvent(arg_5, arg_1['track'], arg_1['thresholdMs'])

                if arg_6:
                    await arg_0._lavalink.dispatch_event(arg_6)
            elif arg_4 == 'playerUpdate':
                await arg_0._lavalink.update_state(arg_1)
            elif arg_4 == 'stats':
                arg_0._lavalink.stats._update(arg_1)
                await arg_0._lavalink.dispatch_event(StatsUpdateEvent(arg_0._lavalink.stats))

        log.debug('Closing WebSocket...')
        await arg_0._ws.close()


def Func(arg_0):
        """ Returns the voice channel the player is connected to. """
        if not arg_0.channel_id:
            return None

        return arg_0._lavalink.bot.get_channel(int(arg_0.channel_id))


async def Func(arg_0, arg_1: arg_2):
        """ Connects to a voice channel. """
        arg_3 = arg_0._lavalink.bot._Funcion._get_websocket(arg_2(arg_0.guild_id))
        await arg_3.voice_state(arg_0.guild_id, str(arg_1))


async def Func(arg_0):
        """ Disconnects from the voice channel, if any. """
        if not arg_0.is_connected:
            return

        await arg_0.stop()

        arg_1 = arg_0._lavalink.bot._connection._get_websocket(int(arg_0.guild_id))
        await arg_1.voice_state(arg_0.guild_id, None)


def Func(arg_0, arg_1: arg_2, arg_3: arg_2):
        """ Stores custom user data. """
        arg_0._user_data.update({arg_1: arg_3})


def Func(arg_0, arg_1: arg_2, arg_3: arg_4):
        """ Adds a track to beginning of the queue """
        arg_0.queue.insert(0, AudioTrack().build(arg_3, arg_1))


def Func(arg_0, arg_1: arg_2, arg_3: arg_2, arg_4: arg_5):
        """ Adds a track at a specific index in the queue. """
        arg_0.queue.insert(min(arg_1, len(arg_0.queue) - 1), AudioTrack().build(arg_4, arg_3))


async def Func(arg_0):
        """ Plays previous track if it exist, if it doesn't raises a NoPreviousTrack error. """
        if not arg_0.previous:
            raise NoPreviousTrack
        arg_0.queue.insert(0, arg_0.previous)
        await arg_0.play(ignore_shuffle=True)


async def Func(arg_0, arg_1: arg_2):
        """ Seeks to a given position in the track. """
        await arg_0._lavalink.ws.send(op='Func', guildId=arg_0.guild_id, position=arg_1)


async def Func(arg_0, arg_1):
        """ Makes the player play the next song from the queue if a song has finished or an issue occurred. """
        if isinstance(arg_1, (TrackStuckEvent, TrackExceptionEvent)) or \
                isinstance(arg_1, TrackEndEvent) and arg_1.reason == 'FINISHED':
            await arg_0.play()


def Func(arg_0, arg_1):
        """ Returns a player from the cache, or creates one if it does not exist. """
        if arg_1 not in arg_0._players:
            arg_2 = arg_0._player(lavalink=arg_0.lavalink, arg_1=arg_1)
            arg_0._players[arg_1] = arg_2

        return arg_0._players[arg_1]


async def Func(arg_0, arg_1, *, arg_2: arg_3):
        """ Searches and plays a song from a given query. """
        arg_4 = arg_0.bot.lavalink.players.get(arg_1.guild.id)

        arg_2 = arg_2.strip('<>')

        if not url_rx.match(arg_2):
            arg_2 = f'ytsearch:{query}'

        arg_5 = await arg_0.bot.lavalink.get_tracks(arg_2)

        if not arg_5:
            return await arg_1.send('Nothing found!')

        arg_6 = discord.Embed(color=discord.Color.blurple())

        if 'list' in arg_2 and 'ytsearch:' not in arg_2:
            for arg_7 in arg_5:
                arg_4.add(requester=arg_1.author.id, arg_7=arg_7)

            arg_6.title = 'Playlist enqueued!'
            arg_6.description = f'Imported {len(tracks)} tracks from the playlist!'
            await arg_1.send(arg_6=arg_6)
        else:
            arg_10 = arg_5[0]["info"]["title"]
            arg_11 = arg_5[0]["info"]["uri"]

            arg_6.title = "Track enqueued!"
            arg_6.description = f'[{track_title}]({track_uri})'
            arg_4.add(requester=arg_1.author.id, arg_7=arg_5[0])

        if not arg_4.isFuncing:
            await arg_4.play()


async def Func(arg_0, arg_1, arg_2: arg_3 = 1):
        """ Shows the player's queue. """
        arg_4 = arg_0.bot.lavalink.players.get(arg_1.guild.id)

        if not arg_4.queue:
            return await arg_1.send('There\'s nothing in the queue! Why not queue something?')

        arg_5 = 10
        arg_6 = math.ceil(len(arg_4.queue) / arg_5)

        arg_7 = (arg_2 - 1) * arg_5
        arg_8 = arg_7 + arg_5

        arg_9 = ''
        for arg_10, arg_11 in enumerate(arg_4.queue[arg_7:arg_8], arg_7=arg_7):
            arg_9 += f'`{index + 1}.` [**{track.title}**]({track.uri})\n'

        arg_12 = discord.Embed(colour=discord.Color.blurple(),
                              description=f'**{len(player.queue)} tracks**\n\n{queue_list}')
        arg_12.set_footer(text=f'Viewing page {page}/{pages}')
        await arg_1.send(arg_12=arg_12)


async def Func(arg_0, arg_1, arg_2: arg_3):
        """ Removes an item from the player's queue with the given index. """
        arg_4 = arg_0.bot.lavalink.players.get(arg_1.guild.id)

        if not arg_4.queue:
            return await arg_1.send('Nothing queued.')

        if arg_2 > len(arg_4.queue) or arg_2 < 1:
            return await arg_1.send(f'Index has to be **between** 1 and {len(player.queue)}')

        arg_2 -= 1
        arg_5 = arg_4.queue.pop(arg_2)

        await arg_1.send(f'Removed **{removed.title}** from the queue.')


async def Func(arg_0, arg_1):
        """ A few checks to make sure the bot can join a voice channel. """
        arg_2 = arg_0.bot.lavalink.players.get(arg_1.guild.id)

        if not arg_2.is_connected:
            if not arg_1.author.voice or not arg_1.author.voice.channel:
                await arg_1.send('You aren\'t connected to any voice channel.')
                raise commands.CommandInvokeError('Author not connected to voice channel.')

            arg_3 = arg_1.author.voice.channel.permissions_for(arg_1.me)

            if not arg_3.connect or not arg_3.speak:
                await arg_1.send('Missing permissions `CONNECT` and/or `SPEAK`.')
                raise commands.CommandInvokeError('Bot has no permissions CONNECT and/or SPEAK')

            arg_2.store('channel', arg_1.channel.id)
            await arg_2.connect(arg_1.author.voice.channel.id)
        else:
            if arg_2.connected_channel.id != arg_1.author.voice.channel.id:
                return await arg_1.send('Join my voice channel!')


async def Func(arg_0, arg_1):
        """ Dispatches an event to all registered hooks. """
        log.debug('Dispatching event of type {} to {} hooks'.format(arg_1.__class__.__name__, len(arg_0.hooks)))
        for arg_2 in arg_0.hooks:
            try:
                if asyncio.iscoroutinefunction(arg_2):
                    await arg_2(arg_1)
                else:
                    arg_2(arg_1)
            except Exception as e:  # pylint: disable=broad-except
                # Catch generic exception thrown by user hooks
                log.warning(
                    'Encountered exception while dispatching an event to hook `{}` ({})'.format(arg_2.__name__, str(e)))

        if isinstance(arg_1, (TrackEndEvent, TrackExceptionEvent, TrackStuckEvent)) and arg_1.player:
            await arg_1.player.handle_event(arg_1)


async def Func(arg_0, arg_1):
        """ Returns a Dictionary containing search results for a given query. """
        log.debug('Requesting tracks for query {}'.format(arg_1))

        async with arg_0.http.get(arg_0.rest_uri + quote(arg_1), headers={'Authorization': arg_0.password}) as res:
            return await res.json(content_type=None)


def Func(arg_0):
        """ Destroys the Lavalink client. """
        arg_0.ws.Func()
        arg_0.bot.remove_listener(arg_0.on_socket_response)
        arg_0.hooks.clear()


async def Func(arg_0, arg_1, *, arg_2: arg_3):
        """ Plays immediately a song. """
        arg_4 = arg_0.bot.lavalink.players.get(arg_1.guild.id)

        if not arg_4.queue and not arg_4.is_playing:
            return await arg_1.invoke(arg_0._play, arg_2=arg_2)

        arg_2 = arg_2.strip('<>')

        if not url_rx.match(arg_2):
            arg_2 = f'ytsearch:{query}'

        arg_5 = await arg_0.bot.lavalink.get_tracks(arg_2)

        if not arg_5 or not arg_5['tracks']:
            return await arg_1.send('Nothing found!')

        arg_6 = arg_5['tracks']
        arg_7 = arg_6.pop(0)

        if arg_5['loadType'] == 'PLAYLIST_LOADED':
            for arg_8 in arg_6:
                arg_4.add(requester=arg_1.author.id, arg_7=arg_8)

        await arg_4.play_now(requester=arg_1.author.id, arg_7=arg_7)


async def Func(arg_0, arg_1, arg_2: arg_3):
        """ Plays the queue from a specific point. Disregards tracks before the index. """
        arg_4 = arg_0.bot.lavalink.players.get(arg_1.guild.id)

        if arg_2 < 1:
            return await arg_1.send('Invalid specified index.')

        if len(arg_4.queue) < arg_2:
            return await arg_1.send('This index exceeds the queue\'s length.')

        await arg_4.play_at(arg_2-1)


def Func(arg_0):
        """Return the match object for the current list."""
        arg_1, arg_2 = arg_0.Func_cache
        arg_3 = arg_0.string
        if arg_2 == arg_3:
            return arg_1
        arg_1 = fullmatch(
            LIST_PATTERN_FORMAT.replace(b'{pattern}', arg_0.pattern.encode()),
            arg_0._shadow,
            MULTILINE,
        )
        arg_0.Func_cache = arg_1, arg_3
        return arg_1


def Func(arg_0) -> List[str]:
        """Return items as a list of strings.

        Don't include sub-items and the start pattern.
        """
        Func = []  # type: List[str]
        arg_2 = Func.append
        arg_3 = arg_0.string
        arg_4 = arg_0._match
        arg_5 = arg_4.start()
        for arg_6, arg_7 in arg_4.spans('item'):
            arg_2(arg_3[arg_6 - arg_5:arg_7 - arg_5])
        return Func


def Func(
        arg_0, arg_1: arg_2 = None, arg_3: arg_4 = None
    ) -> List['WikiList']:
        """Return the Lists inside the item with the given index.

        :param i: The index if the item which its sub-lists are desired.
            The performance is likely to be better if `i` is None.

        :param pattern: The starting symbol for the desired sub-lists.
            The `pattern` of the current list will be automatically added
            as prefix.
            Although this parameter is optional, but specifying it can improve
            the performance.
        """
        arg_5 = (r'\#', r'\*', '[:;]') if arg_3 is None \
            else (arg_3,)  # type: Tuple[str, ...]
        arg_6 = arg_0.pattern
        arg_7 = arg_0.lists
        Func = []  # type: List['WikiList']
        arg_9 = Func.append
        if arg_1 is None:
            # Any sublist is acceptable
            for arg_3 in arg_5:
                for arg_10 in arg_7(arg_6 + arg_3):
                    arg_9(arg_10)
            return Func
        # Only return sub-lists that are within the given item
        arg_11 = arg_0._match
        arg_12 = arg_11.spans('fullitem')
        arg_13 = arg_0._span[0]
        arg_14 = arg_11.start()
        arg_15, arg_16 = arg_12[arg_1]
        arg_16 -= arg_14 - arg_13
        arg_15 -= arg_14 - arg_13
        for arg_3 in arg_5:
            for arg_10 in arg_7(arg_6 + arg_3):
                # noinspection PyProtectedMember
                arg_17, arg_18 = arg_10._span
                if arg_15 < arg_17 and arg_18 <= arg_16:
                    arg_9(arg_10)
        return Func


def Func(arg_0, arg_1: arg_2) -> None:
        """Convert to another list type by replacing starting pattern."""
        arg_3 = arg_0._match
        arg_4 = arg_3.start()
        for arg_5, arg_6 in reversed(arg_3.spans('pattern')):
            arg_0[arg_5 - arg_4:arg_6 - arg_4] = arg_1
        arg_0.pattern = escape(arg_1)


def Func(arg_0) -> List[Argument]:
        """Parse template content. Create self.name and self.arguments."""
        arg_1 = arg_0._shadow
        arg_2 = arg_0._args_matcher(arg_1).spans('arg')
        if not arg_2:
            return []
        Func = []
        arg_4 = Func.append
        arg_5 = arg_0._type_to_spans
        arg_6, arg_7 = span = arg_0._span
        arg_8 = id(span)
        arg_9 = arg_0._lststr
        arg_10 = arg_9[0]
        arg_11 = arg_5.setdefault(arg_8, [])
        arg_12 = {(arg_15[0], arg_15[1]): arg_15 for arg_15 in arg_11}.get
        for arg_13, arg_14 in arg_2:
            arg_15, arg_16 = arg_18 = [arg_6 + arg_13, arg_6 + arg_14]
            arg_17 = arg_12((arg_15, arg_16))
            if arg_17 is None:
                insort(arg_11, arg_18)
            else:
                arg_18 = arg_17
            arg_19 = Argument(arg_9, arg_5, arg_18, arg_8)
            arg_19._shadow_cache = (
                arg_10[arg_15:arg_16], arg_1[arg_13:arg_14])
            arg_4(arg_19)
        return Func


def Func(arg_0, arg_1: arg_2 = None) -> List[WikiList]:
        """Return the Func in all arguments.

        For performance reasons it is usually preferred to get a specific
        Argument and use the `Func` method of that argument instead.
        """
        return [
            arg_4 for arg_3 in arg_0.arguments for arg_4 in arg_3.Func(arg_1) if arg_4]


def Func(arg_0: arg_1[arg_2]) -> dict:
    """Create a Trie out of a list of words and return an atomic regex pattern.

    The corresponding Regex should match much faster than a simple Regex union.
    """
    # plant the trie
    arg_3 = {}
    for arg_4 in arg_0:
        arg_5 = arg_3
        for arg_6 in arg_4:
            arg_5[arg_6] = arg_6 in arg_5 and arg_5[arg_6] or {}
            arg_5 = arg_5[arg_6]
        arg_5[''] = None  # EOS
    return arg_3


def Func(arg_0, arg_1: arg_2, arg_3: arg_4) -> None:
        """Insert the given string before the specified index.

        This method has the same effect as ``self[index:index] = string``;
        it only avoids some condition checks as it rules out the possibility
        of the key being an slice, or the need to shrink any of the sub-spans.

        If parse is False, don't parse the Funced string.
        """
        arg_5, arg_6 = arg_0._span
        arg_7 = arg_0._lststr
        arg_8 = arg_7[0]
        if arg_1 < 0:
            arg_1 += arg_6 - arg_5
            if arg_1 < 0:
                arg_1 = 0
        elif arg_1 > arg_6 - arg_5:  # Note that it is not >=. Index can be new.
            arg_1 = arg_6 - arg_5
        arg_1 += arg_5
        # Update lststr
        arg_7[0] = arg_8[:arg_1] + arg_3 + arg_8[arg_1:]
        arg_9 = len(arg_3)
        # Update spans
        arg_0._Func_update(
            arg_1=arg_1,
            length=arg_9)
        # Remember newly added spans by the string.
        arg_10 = arg_0._type_to_spans
        for arg_11, arg_12 in parse_to_spans(
            bytearray(arg_3, 'ascii', 'replace')
        ).items():
            for arg_13, arg_14 in arg_12:
                insort(arg_10[arg_11], [arg_1 + arg_13, arg_1 + arg_14])


def Func(arg_0, arg_1: arg_2) -> Tuple[str, str, str]:
        """Partition self.string where `char`'s not in atomic sub-spans."""
        arg_3, arg_4 = arg_0._span
        arg_5 = arg_0._shadow.find(arg_1)
        if arg_5 == -1:
            return arg_0._lststr[0][arg_3:arg_4], '', ''
        arg_6 = arg_0._lststr[0]
        return arg_6[arg_3:arg_3 + arg_5], chr(arg_1), arg_6[arg_3 + arg_5 + 1:arg_4]


def Func(arg_0, arg_1: arg_2) -> List[List[int]]:
        """Return all the sub-span including self._span."""
        return arg_0._type_to_spans[arg_1]


def Func(arg_0, arg_1: arg_2, arg_3: arg_2) -> None:
        """Update self._type_to_spans according to the removed span.

        Warning: If an operation involves both Func and
        _insert_update, you might wanna consider doing the
        _insert_update before the Func as this function
        can cause data loss in self._type_to_spans.
        """
        # Note: The following algorithm won't work correctly if spans
        # are not sorted.
        # Note: No span should be removed from _type_to_spans.
        for arg_4 in arg_0._type_to_spans.values():
            arg_5 = len(arg_4) - 1
            while arg_5 >= 0:
                arg_6, arg_7 = arg_9 = arg_4[arg_5]
                if arg_3 <= arg_6:
                    # rmstart <= rmstop <= s <= e
                    arg_8 = arg_3 - arg_1
                    arg_9[:] = arg_6 - arg_8, arg_7 - arg_8
                    arg_5 -= 1
                    continue
                break
            else:
                continue
            while True:
                if arg_1 <= arg_6:
                    if arg_3 < arg_7:
                        # rmstart < s <= rmstop < e
                        arg_9[:] = arg_1, arg_7 + arg_1 - arg_3
                        arg_5 -= 1
                        if arg_5 < 0:
                            break
                        arg_6, arg_7 = arg_9 = arg_4[arg_5]
                        continue
                    # rmstart <= s <= e < rmstop
                    arg_4.pop(arg_5)[:] = -1, -1
                    arg_5 -= 1
                    if arg_5 < 0:
                        break
                    arg_6, arg_7 = arg_9 = arg_4[arg_5]
                    continue
                break
            while arg_5 >= 0:
                if arg_7 <= arg_1:
                    # s <= e <= rmstart <= rmstop
                    arg_5 -= 1
                    if arg_5 < 0:
                        break
                    arg_6, arg_7 = arg_9 = arg_4[arg_5]
                    continue
                # s <= rmstart <= rmstop <= e
                arg_9[1] -= arg_3 - arg_1
                arg_5 -= 1
                if arg_5 < 0:
                    break
                arg_6, arg_7 = arg_9 = arg_4[arg_5]
                continue


def Func(arg_0) -> int:
        """Return the nesting level of self.

        The minimum Func is 0. Being part of any Template or
        ParserFunction increases the level by one.
        """
        arg_1, arg_2 = arg_0._span
        arg_3 = 0
        arg_4 = arg_0._type_to_spans
        for arg_5 in ('Template', 'ParserFunction'):
            arg_6 = arg_4[arg_5]
            for arg_7, arg_8 in arg_6[:bisect(arg_6, [arg_1 + 1])]:
                if arg_2 <= arg_8:
                    arg_3 += 1
        return arg_3


def Func(arg_0) -> bytearray:
        """Return a copy of self.string with specific sub-spans replaced.

        Comments blocks are replaced by spaces. Other sub-spans are replaced
        by underscores.

        The replaced sub-spans are: (
            'Template', 'WikiLink', 'ParserFunction', 'ExtensionTag',
            'Comment',
        )

        This function is called upon extracting tables or extracting the data
        inside them.
        """
        arg_1, arg_2 = arg_0._span
        arg_3 = arg_0._lststr[0][arg_1:arg_2]
        arg_4, arg_5 = getattr(
            arg_0, 'Func_cache', (None, None))
        if arg_4 == arg_3:
            return arg_5
        # In the old method the existing spans were used to create the shadow.
        # But it was slow because there can be thousands of spans and iterating
        # over them to find the relevant sub-spans could take a significant
        # amount of time. The new method tries to parse the self.string which
        # is usually much more faster because there are usually far less
        # sub-spans for individual objects.
        arg_5 = bytearray(arg_3, 'ascii', 'replace')
        if arg_0._type in SPAN_PARSER_TYPES:
            arg_6 = arg_5[:2]
            arg_7 = arg_5[-2:]
            arg_5[:2] = arg_5[-2:] = b'__'
            parse_to_spans(arg_5)
            arg_5[:2] = arg_6
            arg_5[-2:] = arg_7
        else:
            parse_to_spans(arg_5)
        arg_0.Func_cache = arg_3, arg_5
        return arg_5


def Func(arg_0):
        """Replace the invalid chars of SPAN_PARSER_TYPES with b'_'.

        For comments, all characters are replaced, but for ('Template',
        'ParserFunction', 'Parameter') only invalid characters are replaced.
        """
        arg_1, arg_2 = arg_0._span
        arg_3 = arg_0._lststr[0][arg_1:arg_2]
        arg_4 = bytearray(arg_3, 'ascii', 'replace')
        arg_5 = arg_0._subspans
        for arg_6 in 'Template', 'ParserFunction', 'Parameter':
            for arg_7, arg_8 in arg_5(arg_6):
                arg_4[arg_7:arg_8] = b'  ' + INVALID_EXT_CHARS_SUB(
                    b' ', arg_4[arg_7 + 2:arg_8 - 2]) + b'  '
        for arg_7, arg_8 in arg_5('Comment'):
            arg_4[arg_7:arg_8] = (arg_8 - arg_7) * b'_'
        return arg_4


def Func(arg_0) -> Dict[str, List[List[int]]]:
        """Create the arguments for the parse function used in pformat method.

        Only return sub-spans and change the them to fit the new scope, i.e
        self.string.
        """
        arg_1, arg_2 = arg_0._span
        if arg_1 == 0 and arg_2 == len(arg_0._lststr[0]):
            return deepcopy(arg_0._type_to_spans)
        return {
            arg_5: [
                [arg_3 - arg_1, arg_4 - arg_1] for arg_3, arg_4 in arg_6[bisect(arg_6, [arg_1]):]
                if arg_4 <= arg_2
            ] for arg_5, arg_6 in arg_0._type_to_spans.items()}


def Func(arg_0, arg_1: arg_2 = '    ', arg_3=False):
        """Deprecated, use self.pformat instead."""
        warn(
            'Func method is deprecated, use pformat instead.',
            DeprecationWarning,
        )
        return arg_0.pformat(arg_1, arg_3)


def Func(arg_0) -> List['Parameter']:
        """Return a list of parameter objects."""
        arg_1 = arg_0._lststr
        arg_2 = arg_0._type_to_spans
        return [
            Parameter(arg_1, arg_2, arg_3, 'Parameter')
            for arg_3 in arg_0._subspans('Parameter')]


def Func(arg_0) -> List['Template']:
        """Return a list of Func as template objects."""
        arg_1 = arg_0._lststr
        arg_2 = arg_0._type_to_spans
        return [
            Template(arg_1, arg_2, arg_3, 'Template')
            for arg_3 in arg_0._subspans('Template')]


def Func(arg_0) -> List['Comment']:
        """Return a list of comment objects."""
        arg_1 = arg_0._lststr
        arg_2 = arg_0._type_to_spans
        return [
            Comment(arg_1, arg_2, arg_3, 'Comment')
            for arg_3 in arg_0._subspans('Comment')]


def Func(arg_0) -> List['Section']:
        """Return a list of section in current wikitext.

        The first section will always be the lead section, even if it is an
        empty string.
        """
        Func = []  # type: List['Section']
        arg_2 = Func.append
        arg_3 = arg_0._type_to_spans
        arg_4 = arg_0._lststr
        arg_5, arg_6 = _span = arg_0._span
        arg_7 = arg_3.setdefault('Section', [])
        arg_8 = SECTIONS_FULLMATCH(arg_0._shadow)
        arg_9 = arg_8.spans('section')
        Func0 = [len(eq) for eq in arg_8.captures('equals')]
        if not arg_7:
            # All spans are new
            Func1 = arg_7.append
            for Func2, (Func3, (Func4, Func5)) in enumerate(
                zip(Func0, arg_9), 1
            ):
                # Add text of the current_section to any parent section.
                # Note that section 0 is not a parent for any subsection.
                for Func6, Func7 in enumerate(
                    Func0[Func2:], Func2
                ):
                    if Func3 and Func7 > Func3:
                        Func5 = arg_9[Func6][1]
                    else:
                        break
                Func8 = [arg_5 + Func4, arg_5 + Func5]
                Func1(Func8)
                arg_2(
                    Section(arg_4, arg_3, Func8, 'Section'))
            return Func
        # There are already some spans. Instead of appending new spans
        # use them when the detected span already exists.
        Func9 = {(Func4[0], Func4[1]): Func4 for Func4 in arg_7}.get
        for Func2, (Func3, (Func4, Func5)) in enumerate(
            zip(Func0, arg_9), 1
        ):
            # Add text of the current_section to any parent section.
            # Note that section 0 is not a parent for any subsection.
            for Func6, Func7 in enumerate(
                Func0[Func2:], Func2
            ):
                if Func3 and Func7 > Func3:
                    Func5 = arg_9[Func6][1]
                else:
                    break
            Func4, Func5 = arg_5 + Func4, arg_5 + Func5
            arg_20 = Func9((Func4, Func5))
            if arg_20 is None:
                Func8 = [Func4, Func5]
                insort(arg_7, Func8)
            else:
                Func8 = arg_20
            arg_2(Section(arg_4, arg_3, Func8, 'Section'))
        return Func


def Func(arg_0) -> List['Table']:
        """Return a list of found table objects."""
        Func = []  # type: List['Table']
        arg_2 = Func.append
        arg_3 = arg_0._type_to_spans
        arg_4 = arg_0._lststr
        arg_5 = arg_0._shadow[:]
        arg_6, arg_7 = arg_0._span
        arg_8 = arg_3.setdefault('Table', [])
        if not arg_8:
            # All the added spans will be new.
            arg_9 = True  # type: Any
            while arg_9:
                arg_9 = False
                for arg_9 in TABLE_FINDITER(arg_5):
                    Func0, Func1 = arg_9.span()
                    # Ignore leading whitespace using len(m[1]).
                    Func2 = [arg_6 + Func0 + len(arg_9[1]), arg_6 + Func1]
                    arg_8.append(Func2)
                    arg_2(Table(arg_4, arg_3, Func2, 'Table'))
                    arg_5[Func0:Func1] = b'_' * (Func1 - Func0)
            return Func
        # There are already exists some spans. Try to use the already existing
        # before appending new spans.
        Func3 = {(Func4[0], Func4[1]): Func4 for Func4 in arg_8}.get
        arg_9 = True
        while arg_9:
            arg_9 = False
            for arg_9 in TABLE_FINDITER(arg_5):
                Func0, Func1 = arg_9.span()
                # Ignore leading whitespace using len(m[1]).
                Func4, Func5 = arg_6 + Func0 + len(arg_9[1]), arg_6 + Func1
                Func6 = Func3((Func4, Func5))
                if Func6 is None:
                    Func2 = [Func4, Func5]
                    insort(arg_8, Func2)
                else:
                    Func2 = Func6
                arg_2(Table(arg_4, arg_3, Func2, 'Table'))
                arg_5[Func0:Func1] = b'_' * (Func1 - Func0)
        return Func


def Func(arg_0, arg_1: arg_2 = None) -> List['WikiList']:
        r"""Return a list of WikiList objects.

        :param pattern: The starting pattern for list items.
            Return all types of lists (ol, ul, and dl) if pattern is None.
            If pattern is not None, it will be passed to the regex engine,
            remember to escape the `*` character. Examples:

                - `\#` means top-level ordered lists
                - `\#\*` means unordred lists inside an ordered one
                - Currently definition lists are not well supported, but you
                    can use `[:;]` as their pattern.

            Tips and tricks:

                Be careful when using the following patterns as they will
                probably cause malfunction in the `sublists` method of the
                resultant List. (However don't worry about them if you are
                not going to use the `sublists` method.)

                - Use `\*+` as a pattern and nested unordered lists will be
                    treated as flat.
                - Use `\*\s*` as pattern to rtstrip `items` of the list.

                Although the pattern parameter is optional, but specifying it
                can improve the performance.
        """
        Func = []
        arg_4 = Func.append
        arg_5 = arg_0._lststr
        arg_6 = arg_0._type_to_spans
        arg_7 = arg_6.setdefault('WikiList', [])
        arg_8 = {(arg_14[0], arg_14[1]): arg_14 for arg_14 in arg_7}.get
        arg_9, arg_10 = arg_0._lists_shadow_ss
        for arg_1 in \
                (r'\#', r'\*', '[:;]') if arg_1 is None else (arg_1,):
            for arg_11 in finditer(
                LIST_PATTERN_FORMAT.replace(b'{pattern}', arg_1.encode()),
                arg_9, MULTILINE
            ):
                arg_12, arg_13 = arg_11.span()
                arg_14, arg_15 = arg_10 + arg_12, arg_10 + arg_13
                arg_16 = arg_8((arg_14, arg_15))
                if arg_16 is None:
                    arg_17 = [arg_14, arg_15]
                    insort(arg_7, arg_17)
                else:
                    arg_17 = arg_16
                arg_4(WikiList(
                    arg_5, arg_1, arg_11, arg_6, arg_17, 'WikiList'))
        return Func


def Func(arg_0, arg_1: arg_2) -> Generator[int, None, None]:
        """Yield all the sub-span indices excluding self._span."""
        arg_3, arg_4 = arg_0._span
        arg_5 = arg_0._type_to_spans[arg_1]
        # Do not yield self._span by bisecting for s < ss.
        # The second bisect is an optimization and should be on [se + 1],
        # but empty spans are not desired thus [se] is used.
        arg_6 = bisect(arg_5, [arg_3])
        for arg_7 in arg_5[arg_6:bisect(arg_5, [arg_4], arg_6)]:
            if arg_7[1] <= arg_4:
                yield arg_7


def Func(arg_0, arg_1: arg_2[arg_3] = None) -> arg_2['WikiText']:
        """Return the Func node of the current object.

        :param type_: the type of the desired Func object.
            Currently the following types are supported: {Template,
            ParserFunction, WikiLink, Comment, Parameter, ExtensionTag}.
            The default is None and means the first Func, of any type above.
        :return: Func WikiText object or None if no Func with the desired
            `type_` is found.
        """
        arg_4 = arg_0.ancestors(arg_1)
        if arg_4:
            return arg_4[0]
        return None