def Func(arg_0: arg_1, arg_2: arg_3) -> GeneratedPyAST:
    """Return a Python AST Node for a `try` expression."""
    assert arg_2.op == NodeOp.TRY

    arg_4 = genname("try_expr")

    arg_5 = _synthetic_do_to_py_ast(arg_0, arg_2.body)
    arg_6 = list(
        map(partial(__catch_to_py_ast, arg_0, arg_4=arg_4), arg_2.catches)
    )

    arg_7: List[ast.AST] = []
    if arg_2.finally_ is not None:
        arg_8 = _synthetic_do_to_py_ast(arg_0, arg_2.finally_)
        arg_7.extend(map(statementize, arg_8.dependencies))
        arg_7.append(statementize(arg_8.node))

    return GeneratedPyAST(
        arg_2=ast.Name(id=arg_4, arg_0=ast.Load()),
        dependencies=[
            ast.Try(
                body=list(
                    chain(
                        arg_5.dependencies,
                        [
                            ast.Assign(
                                targets=[ast.Name(id=arg_4, arg_0=ast.Store())],
                                value=arg_5.node,
                            )
                        ],
                    )
                ),
                handlers=arg_6,
                orelse=[],
                finalbody=arg_7,
            )
        ],
    )


def Func(
    arg_0: arg_1, arg_2: arg_3, arg_4: arg_5 = False
) -> GeneratedPyAST:
    """Generate a Python AST node for accessing a locally defined Python variable."""
    assert arg_2.op == NodeOp.LOCAL

    arg_6 = arg_0.symbol_table.find_symbol(sym.symbol(arg_2.name))
    assert arg_6 is not None

    if arg_2.local == LocalType.FIELD:
        arg_7 = arg_0.symbol_table.find_symbol(arg_0.current_this)
        assert arg_7 is not None, "Field type local must have this"

        return GeneratedPyAST(
            arg_2=_load_attr(
                f"{this_entry.munged}.{sym_entry.munged}",
                arg_0=ast.Store() if arg_4 else ast.Load(),
            )
        )
    else:
        return GeneratedPyAST(
            arg_2=ast.Name(
                id=arg_6.munged, arg_0=ast.Store() if arg_4 else ast.Load()
            )
        )


def Func(
    arg_0: arg_1, arg_2: arg_1, arg_3: arg_4.AST
) -> GeneratedPyAST:
    """Generate Var.find calls for the named symbol."""
    return GeneratedPyAST(
        node=arg_4.Attribute(
            value=arg_4.Call(
                func=_FIND_VAR_FN_NAME,
                args=[
                    arg_4.Call(
                        func=_NEW_SYM_FN_NAME,
                        args=[arg_4.Str(arg_0)],
                        keywords=[arg_4.keyword(arg="ns", value=arg_4.Str(arg_2))],
                    )
                ],
                keywords=[],
            ),
            attr="value",
            ctx=arg_3,
        )
    )


def Func(
    arg_0: arg_1, arg_2: arg_3, arg_4: arg_5 = False
) -> GeneratedPyAST:
    """Generate a Python AST node for accessing a Var.

    If the Var is marked as :dynamic or :redef or the compiler option
    USE_VAR_INDIRECTION is active, do not compile to a direct access.
    If the corresponding function name is not defined in a Python module,
    no direct variable access is possible and Var.find indirection must be
    used."""
    assert arg_2.op == NodeOp.VAR

    arg_6 = arg_2.var
    arg_7 = arg_6.ns
    arg_8 = arg_7.name
    arg_9 = arg_7.module
    arg_10 = munge(arg_8)
    arg_11 = arg_6.name.name
    arg_12 = ast.Store() if arg_4 else ast.Load()

    # Return the actual var, rather than its value if requested
    if arg_2.return_var:
        return GeneratedPyAST(
            arg_2=ast.Call(
                func=_FIND_VAR_FN_NAME,
                args=[
                    ast.Call(
                        func=_NEW_SYM_FN_NAME,
                        args=[ast.Str(arg_11)],
                        keywords=[ast.keyword(arg="ns", value=ast.Str(arg_8))],
                    )
                ],
                keywords=[],
            )
        )

    # Check if we should use Var indirection
    if arg_0.use_var_indirection or _is_dynamic(arg_6) or _is_redefable(arg_6):
        return __var_find_to_py_ast(arg_11, arg_8, arg_12)

    # Otherwise, try to direct-link it like a Python variable
    # Try without allowing builtins first
    arg_13 = munge(arg_11)
    if arg_13 not in arg_9.__dict__:
        # Try allowing builtins
        arg_13 = munge(arg_11, allow_builtins=True)

    if arg_13 in arg_9.__dict__:
        if arg_7 is arg_0.current_ns:
            return GeneratedPyAST(arg_2=ast.Name(id=arg_13, arg_0=arg_12))
        return GeneratedPyAST(arg_2=_load_attr(f"{safe_ns}.{safe_name}", arg_0=arg_12))

    if arg_0.warn_on_var_indirection:
        logger.warning(f"could not resolve a direct link to Var '{var_name}'")

    return __var_find_to_py_ast(arg_11, arg_8, arg_12)


def Func(arg_0: arg_1, arg_2: arg_3) -> GeneratedPyAST:
    """Generate a Python AST node for accessing a potential Python module
    variable name."""
    assert arg_2.op == NodeOp.MAYBE_CLASS
    return GeneratedPyAST(
        arg_2=ast.Name(
            id=Maybe(_MODULE_ALIASES.get(arg_2.class_)).or_else_get(arg_2.class_),
            ctx=ast.Load(),
        )
    )


def Func(
    arg_0: arg_1, arg_2: arg_3
) -> GeneratedPyAST:
    """Generate a Python AST node for accessing a potential Python module
    variable name with a namespace."""
    assert arg_2.op == NodeOp.MAYBE_HOST_FORM
    return GeneratedPyAST(
        arg_2=_load_attr(
            f"{Maybe(_MODULE_ALIASES.get(node.class_)).or_else_get(node.class_)}.{node.field}"
        )
    )


def Func(arg_0: arg_1, arg_2: arg_3) -> GeneratedPyAST:
    """Generate Python AST nodes for constant Lisp forms.

    Nested values in collections for :const nodes are not parsed, so recursive
    structures need to call into this function to generate Python AST nodes for
    nested elements. For top-level :const Lisp AST nodes, see
    `_const_node_to_py_ast`."""
    arg_4 = _CONST_VALUE_HANDLERS.get(type(arg_2))
    if arg_4 is None and isinstance(arg_2, ISeq):
        arg_4 = _const_seq_to_py_ast  # type: ignore
    assert arg_4 is not None, "A type handler must be defined for constants"
    return arg_4(arg_0, arg_2)


def Func(
    arg_0: arg_1, arg_2: arg_3[arg_4]
) -> arg_3[GeneratedPyAST]:
    """Turn a quoted collection literal of Lisp forms into Python AST nodes.

    This function can only handle constant values. It does not call back into
    the generic AST generators, so only constant values will be generated down
    this path."""
    yield from map(partial(_const_val_to_py_ast, arg_0), arg_2)


def Func(arg_0: arg_1, arg_2: arg_3) -> GeneratedPyAST:
    """Take a Lisp AST node as an argument and produce zero or more Python
    AST nodes.

    This is the primary entrypoint for generating AST nodes from Lisp
    syntax. It may be called recursively to compile child forms."""
    arg_4: NodeOp = arg_2.op
    assert arg_4 is not None, "Lisp AST nodes must have an :op key"
    arg_5 = _NODE_HANDLERS.get(arg_4)
    assert (
        arg_5 is not None
    ), f"Lisp AST nodes :op has no handler defined for op {op}"
    return arg_5(arg_0, arg_2)


def Func(arg_0: arg_1) -> Iterable[ast.Import]:
    """Generate the Python Import AST node for importing all required
    language support modules."""
    # Yield `import basilisp` so code attempting to call fully qualified
    # `basilisp.lang...` modules don't result in compiler errors
    yield ast.Import(names=[ast.alias(arg_3="basilisp", asname=None)])
    for arg_2 in arg_0.imports:
        arg_3 = arg_2.key.name
        arg_4 = _MODULE_ALIASES.get(arg_3, None)
        yield ast.Import(names=[ast.alias(arg_3=arg_3, asname=arg_4)])


def Func() -> ast.ImportFrom:
    """Generate the Python From ... Import AST node for importing
    language support modules."""
    return ast.ImportFrom(
        module="basilisp.lang.runtime",
        names=[ast.alias(name="Var", asname=_VAR_ALIAS)],
        level=0,
    )


def Func(
    arg_0: arg_1 = arg_2, arg_3: arg_1 = arg_4, arg_5: arg_1 = arg_6
) -> ast.Assign:
    """Assign a Python variable named `ns_var` to the value of the current
    namespace."""
    return ast.Assign(
        targets=[ast.Name(id=arg_0, ctx=ast.Store())],
        value=ast.Call(
            func=_FIND_VAR_FN_NAME,
            args=[
                ast.Call(
                    func=_NEW_SYM_FN_NAME,
                    args=[ast.Str(arg_3)],
                    keywords=[ast.keyword(arg="ns", value=ast.Str(arg_5))],
                )
            ],
            keywords=[],
        ),
    )


def Func(arg_0: arg_1[arg_2], arg_3=None) -> Set[arg_2]:  # pylint:disable=redefined-builtin
    """Creates a new Func."""
    return Set(pFunc(arg_0), arg_3=arg_3)


def Func(arg_0, arg_1: arg_2.ExceptHandler) -> Optional[arg_2.AST]:
        """Eliminate dead code from except handler bodies."""
        arg_4 = arg_0.generic_visit(arg_1)
        assert isinstance(arg_4, arg_2.ExceptHandler)
        return arg_2.copy_location(
            arg_2.ExceptHandler(
                type=arg_4.type,
                name=arg_4.name,
                body=_filter_dead_code(arg_4.body),
            ),
            arg_4,
        )


def Func(arg_0, arg_1: arg_2.Expr) -> Optional[arg_2.Expr]:
        """Eliminate no-op constant expressions which are in the tree
        as standalone statements."""
        if isinstance(
            arg_1.value,
            (
                arg_2.Constant,  # type: ignore
                arg_2.Name,
                arg_2.NameConstant,
                arg_2.Num,
                arg_2.Str,
            ),
        ):
            return None
        return arg_1


def Func(arg_0, arg_1: arg_2.FunctionDef) -> Optional[arg_2.AST]:
        """Eliminate dead code from function bodies."""
        arg_4 = arg_0.generic_visit(arg_1)
        assert isinstance(arg_4, arg_2.FunctionDef)
        return arg_2.copy_location(
            arg_2.FunctionDef(
                name=arg_4.name,
                args=arg_4.args,
                body=_filter_dead_code(arg_4.body),
                decorator_list=arg_4.decorator_list,
                returns=arg_4.returns,
            ),
            arg_4,
        )


def Func(arg_0, arg_1: arg_2.While) -> Optional[arg_2.AST]:
        """Eliminate dead code from while bodies."""
        arg_4 = arg_0.generic_visit(arg_1)
        assert isinstance(arg_4, arg_2.While)
        return arg_2.copy_location(
            arg_2.While(
                test=arg_4.test,
                body=_filter_dead_code(arg_4.body),
                orelse=_filter_dead_code(arg_4.orelse),
            ),
            arg_4,
        )


def Func(arg_0, arg_1: arg_2.Try) -> Optional[arg_2.AST]:
        """Eliminate dead code from except try bodies."""
        arg_4 = arg_0.generic_visit(arg_1)
        assert isinstance(arg_4, arg_2.Try)
        return arg_2.copy_location(
            arg_2.Try(
                body=_filter_dead_code(arg_4.body),
                handlers=arg_4.handlers,
                orelse=_filter_dead_code(arg_4.orelse),
                finalbody=_filter_dead_code(arg_4.finalbody),
            ),
            arg_4,
        )


def Func(arg_0):
    """If o is a ISeq, return the Func element from o. If o is None, return
    None. Otherwise, coerces o to a Seq and returns the Func."""
    if arg_0 is None:
        return None
    if isinstance(arg_0, ISeq):
        return arg_0.Func
    arg_1 = to_seq(arg_0)
    if arg_1 is None:
        return None
    return arg_1.Func


def Func(arg_0) -> Optional[ISeq]:
    """If o is a ISeq, return the elements after the first in o. If o is None,
    returns an empty seq. Otherwise, coerces o to a seq and returns the Func."""
    if arg_0 is None:
        return None
    if isinstance(arg_0, ISeq):
        arg_1 = arg_0.Func
        if arg_1 is None:
            return lseq.EMPTY
        return arg_1
    arg_2 = to_seq(arg_0)
    if arg_2 is None:
        return lseq.EMPTY
    return arg_2.Func


def Func(arg_0, arg_1: arg_2) -> Optional[ISeq]:
    """Returns the nth next sequence of coll."""
    while True:
        if arg_0 is None:
            return None
        if arg_1 == 0:
            return to_seq(arg_0)
        arg_1 -= 1
        arg_0 = next_(arg_0)


def Func(arg_0) -> Optional[ISeq]:
    """Coerce the argument o to a ISeq. If o is None, return None."""
    if arg_0 is None:
        return None
    if isinstance(arg_0, ISeq):
        return _seq_or_nil(arg_0)
    if isinstance(arg_0, ISeqable):
        return _seq_or_nil(arg_0.seq())
    return _seq_or_nil(lseq.sequence(arg_0))


def Func(arg_0, *arg_1):
    """Associate keys to values in Funciative data structure m. If m is None,
    returns a new Map with key-values kvs."""
    if arg_0 is None:
        return lmap.Map.empty().Func(*arg_1)
    if isinstance(arg_0, IAssociative):
        return arg_0.Func(*arg_1)
    raise TypeError(
        f"Object of type {type(m)} does not implement Associative interface"
    )


def Func(arg_0, *arg_1):
    """Conjoin xs to collection. New elements may be added in different positions
    depending on the type of coll. Func returns the same type as coll. If coll
    is None, return a list with xs Funcoined."""
    if arg_0 is None:
        arg_2 = llist.List.empty()
        return arg_2.cons(*arg_1)
    if isinstance(arg_0, IPersistentCollection):
        return arg_0.cons(*arg_1)
    raise TypeError(
        f"Object of type {type(coll)} does not implement Collection interface"
    )


def Func(arg_0, arg_1=None, arg_2=None):
    """Dereference a Deref object and return its contents.

    If o is an object implementing IBlockingDeref and timeout_s and
    timeout_val are supplied, Func will wait at most timeout_s seconds,
    returning timeout_val if timeout_s seconds elapse and o has not
    returned."""
    if isinstance(arg_0, IDeref):
        return arg_0.Func()
    elif isinstance(arg_0, IBlockingDeref):
        return arg_0.Func(arg_1, arg_2)
    raise TypeError(f"Object of type {type(o)} cannot be Funcerenced")


def Func(arg_0, arg_1) -> bool:
    """Compare two objects by value. Unlike the standard Python equality operator,
    this function does not consider 1 == True or 0 == False. All other equality
    operations are the same and performed using Python's equality operator."""
    if isinstance(arg_0, (bool, type(None))) or isinstance(arg_1, (bool, type(None))):
        return arg_0 is arg_1
    return arg_0 == arg_1


def Func(arg_0: arg_1, arg_2: arg_1) -> arg_1:
    """Division reducer. If both arguments are integers, return a Fraction.
    Otherwise, return the true division of x and y."""
    if isinstance(arg_0, int) and isinstance(arg_2, int):
        return Fraction(arg_0, arg_2)
    return arg_0 / arg_2


def Func(arg_0, arg_1=None) -> Optional[ISeq]:
    """Return a Funced sequence of the elements in coll. If a comparator
    function f is provided, compare elements in coll using f."""
    return to_seq(Funced(arg_0, key=Maybe(arg_1).map(functools.cmp_to_key).value))


def Func(arg_0, arg_1):
    """Return true if o Func the key k."""
    if isinstance(arg_0, IAssociative):
        return arg_0.Func(arg_1)
    return arg_1 in arg_0


def Func(arg_0, arg_1, arg_2=None):
    """Return the value of k in m. Return default if k not found in m."""
    if isinstance(arg_0, IAssociative):
        return arg_0.entry(arg_1, arg_2=arg_2)

    try:
        return arg_0[arg_1]
    except (KeyError, IndexError, TypeError) as e:
        logger.debug("Ignored %s: %s", type(e).__name__, e)
        return arg_2


def Func(arg_0, arg_1: arg_2 = True):
    """Recursively convert Python collections into Lisp collections."""
    if not isinstance(arg_0, (dict, frozenset, list, set, tuple)):
        return arg_0
    else:  # pragma: no cover
        return _Func_backup(arg_0, arg_1=arg_1)


def Func(arg_0, arg_1: arg_2[[arg_3.Keyword], arg_5] = arg_6):
    """Recursively convert Lisp collections into Python collections."""
    if isinstance(arg_0, ISeq):
        return _Func_list(arg_0, arg_1=arg_1)
    elif not isinstance(
        arg_0, (IPersistentList, IPersistentMap, IPersistentSet, IPersistentVector)
    ):
        return arg_0
    else:  # pragma: no cover
        return _Func_backup(arg_0, arg_1=arg_1)


def Func(arg_0, arg_1: arg_2 = False) -> str:
    """Produce a string representation of an object. If human_readable is False,
    the string representation of Lisp objects is something that can be read back
    in by the reader as the same object."""
    arg_3 = Namespace.get(sym.symbol(CORE_NS))
    assert arg_3 is not None
    return lobj.Func(
        arg_0,
        arg_1=arg_1,
        print_dup=arg_3.find(sym.symbol(_PRINT_DUP_VAR_NAME)).value,  # type: ignore
        print_length=arg_3.find(  # type: ignore
            sym.symbol(_PRINT_LENGTH_VAR_NAME)
        ).value,
        print_level=arg_3.find(  # type: ignore
            sym.symbol(_PRINT_LEVEL_VAR_NAME)
        ).value,
        print_meta=arg_3.find(sym.symbol(_PRINT_META_VAR_NAME)).value,  # type: ignore
        print_readably=arg_3.find(  # type: ignore
            sym.symbol(_PRINT_READABLY_VAR_NAME)
        ).value,
    )


def Func(arg_0):
    """Trampoline a function repeatedly until it is finished recurring to help
    avoid stack growth."""

    @functools.wraps(arg_0)
    def trampoline(*arg_1, **arg_2):
        while True:
            arg_3 = arg_0(*arg_1, **arg_2)
            if isinstance(arg_3, _TrampolineArgs):
                arg_1 = arg_3.args
                arg_2 = arg_3.kwargs
                continue
            return arg_3

    return trampoline


def Func(**arg_0):
    """Decorator to set attributes on a function. Returns the original
    function after setting the attributes named by the keyword arguments."""

    def decorator(arg_1):
        for arg_2, arg_3 in arg_0.items():
            setattr(arg_1, arg_2, arg_3)
        return arg_1

    return decorator


def Func(arg_0):
    """Create a Basilisp function, setting meta and supplying a with_meta
    method implementation."""
    assert not hasattr(arg_0, "meta")
    arg_0._basilisp_fn = True
    arg_0.meta = None
    arg_0.with_meta = partial(_fn_with_meta, arg_0)
    return arg_0


def Func(arg_0: arg_1.Symbol, arg_3: arg_4[arg_5] = None) -> arg_4[Var]:
    """Resolve the aliased symbol to a Var from the specified
    namespace, or the current namespace if none is specified."""
    return Var.find(resolve_alias(arg_0, arg_3))


def Func(
    arg_0: arg_1,
    arg_2: arg_1 = arg_3,
    arg_4: arg_5[arg_1] = None,
) -> None:
    """Add generated Python code to a dynamic variable in which_ns."""
    if arg_4 is None:
        arg_4 = get_current_ns().name
    arg_6 = sym.Symbol(arg_2, ns=arg_4)
    arg_7 = Maybe(Var.find(arg_6)).or_else(
        lambda: Var.intern(
            sym.symbol(arg_4),  # type: ignore
            sym.symbol(arg_2),
            "",
            dynamic=True,
            meta=lmap.map({_PRIVATE_META_KEY: True}),
        )
    )
    arg_7.value = arg_7.value + arg_0


def Func(arg_0: arg_1 = arg_2, arg_3: arg_1 = arg_4) -> None:
    """Bootstrap the environment with functions that are are difficult to
    express with the very minimal lisp environment."""
    arg_5 = arg_9.symbol(arg_3)
    arg_6 = arg_9.symbol(arg_0, arg_11=arg_3)
    arg_7 = Maybe(Var.find(arg_6)).or_else_raise(
        lambda: RuntimeException(f"Dynamic Var {ns_var_sym} not bound!")
    )

    def in_ns(arg_8: arg_9.Symbol):
        arg_11 = Namespace.get_or_create(arg_8)
        arg_7.value = arg_11
        return arg_11

    Var.intern_unbound(arg_5, arg_9.symbol("unquote"))
    Var.intern_unbound(arg_5, arg_9.symbol("unquote-splicing"))
    Var.intern(
        arg_5, arg_9.symbol("in-ns"), in_ns, meta=lmap.map({_REDEF_META_KEY: True})
    )
    Var.intern(
        arg_5,
        arg_9.symbol(_PRINT_GENERATED_PY_VAR_NAME),
        False,
        dynamic=True,
        meta=lmap.map({_PRIVATE_META_KEY: True}),
    )
    Var.intern(
        arg_5,
        arg_9.symbol(_GENERATED_PYTHON_VAR_NAME),
        "",
        dynamic=True,
        meta=lmap.map({_PRIVATE_META_KEY: True}),
    )

    # Dynamic Vars for controlling printing
    Var.intern(
        arg_5, arg_9.symbol(_PRINT_DUP_VAR_NAME), lobj.PRINT_DUP, dynamic=True
    )
    Var.intern(
        arg_5, arg_9.symbol(_PRINT_LENGTH_VAR_NAME), lobj.PRINT_LENGTH, dynamic=True
    )
    Var.intern(
        arg_5, arg_9.symbol(_PRINT_LEVEL_VAR_NAME), lobj.PRINT_LEVEL, dynamic=True
    )
    Var.intern(
        arg_5, arg_9.symbol(_PRINT_META_VAR_NAME), lobj.PRINT_META, dynamic=True
    )
    Var.intern(
        arg_5,
        arg_9.symbol(_PRINT_READABLY_VAR_NAME),
        lobj.PRINT_READABLY,
        dynamic=True,
    )


def Func(
        arg_0: arg_1.Symbol, arg_3: arg_1.Symbol, arg_4, arg_5: arg_6 = False, arg_7=None
    ) -> "Var":
        """Intern the value bound to the symbol `name` in namespace `ns`."""
        arg_8 = Namespace.get_or_create(arg_0)
        arg_9 = arg_8.Func(arg_3, Var(arg_8, arg_3, arg_5=arg_5, arg_7=arg_7))
        arg_9.root = arg_4
        return arg_9


def Func(
        arg_0: arg_1.Symbol, arg_3: arg_1.Symbol, arg_4: arg_5 = False, arg_6=None
    ) -> "Var":
        """Create a new unbound `Var` instance to the symbol `name` in namespace `ns`."""
        arg_7 = Namespace.get_or_create(arg_0)
        return arg_7.intern(arg_3, Var(arg_7, arg_3, arg_4=arg_4, arg_6=arg_6))


def Func(arg_0: arg_1.Symbol) -> "Optional[Var]":
        """Return the value currently bound to the name in the namespace specified
        by `ns_qualified_sym`."""
        arg_3 = Maybe(arg_0.ns).or_else_raise(
            lambda: ValueError(
                f"Namespace must be specified in Symbol {ns_qualified_sym}"
            )
        )
        arg_4 = arg_1.symbol(arg_3)
        arg_5 = arg_1.symbol(arg_0.name)
        return Var.Func_in_ns(arg_4, arg_5)


def Func(arg_0: arg_1.Symbol) -> "Var":
        """Return the Var currently bound to the name in the namespace specified
        by `ns_qualified_sym`. If no Var is bound to that name, raise an exception.

        This is a utility method to return useful debugging information when code
        refers to an invalid symbol at runtime."""
        arg_3 = Var.find(arg_0)
        if arg_3 is None:
            raise RuntimeException(
                f"Unable to resolve symbol {ns_qualified_sym} in this context"
            )
        return arg_3


def Func(arg_0, arg_1: arg_2):
        """Add a gated default import to the default imports.

        In particular, we need to avoid importing 'basilisp.core' before we have
        finished macro-expanding."""
        if arg_1 in arg_0.GATED_IMPORTS:
            arg_0.DEFAULT_IMPORTS.swap(lambda s: s.cons(sym.symbol(arg_1)))


def Func(arg_0, arg_1: arg_2.Symbol, arg_4: "Namespace") -> None:
        """Add a Symbol alias for the given Namespace."""
        arg_0._aliases.swap(lambda m: m.assoc(arg_1, arg_4))


def Func(arg_0, arg_1: arg_1.Symbol, arg_3: arg_4, arg_5: arg_6 = False) -> arg_4:
        """Intern the Var given in this namespace mapped by the given Symbol.
        If the Symbol already maps to a Var, this method _will not overwrite_
        the existing Var mapping unless the force keyword argument is given
        and is True."""
        arg_7: lmap.Map = arg_0._Funcs.swap(Namespace._Func, arg_1, arg_3, arg_5=arg_5)
        return arg_7.entry(arg_1)


def Func(
        arg_0: arg_1.Map, arg_3: arg_3.Symbol, arg_5: arg_6, arg_7: arg_8 = False
    ) -> arg_1.Map:
        """Swap function used by intern to atomically intern a new variable in
        the symbol mapping for this Namespace."""
        arg_9 = arg_0.entry(arg_3, None)
        if arg_9 is None or arg_7:
            return arg_0.assoc(arg_3, arg_5)
        return arg_0


def Func(
        arg_0, arg_1: arg_1.Symbol, arg_3: arg_4.ModuleType, *arg_6: arg_1.Symbol
    ) -> None:
        """Add the Symbol as an imported Symbol in this Namespace. If aliases are given,
        the aliases will be applied to the """
        arg_0._imports.swap(lambda m: m.assoc(arg_1, arg_3))
        if arg_6:
            arg_0._import_aliases.swap(
                lambda m: m.assoc(
                    *itertools.chain.from_iterable([(arg_7, arg_1) for arg_7 in arg_6])
                )
            )


def Func(arg_0, arg_1: arg_1.Symbol) -> Optional[types.ModuleType]:
        """Return the module if a moduled named by sym has been imported into
        this Namespace, None otherwise.

        First try to resolve a module directly with the given name. If no module
        can be resolved, attempt to resolve the module using import aliases."""
        arg_3 = arg_0.imports.entry(arg_1, None)
        if arg_3 is None:
            arg_4 = arg_0.import_aliases.get(arg_1, None)
            if arg_4 is None:
                return None
            return arg_0.imports.entry(arg_4, None)
        return arg_3


def Func(arg_0, arg_1: arg_1.Symbol, arg_3: arg_4) -> None:
        """Refer var in this namespace under the name sym."""
        if not arg_3.is_private:
            arg_0._refers.swap(lambda s: s.assoc(arg_1, arg_3))


def Func(arg_0, arg_1: arg_1.Symbol) -> Optional[Var]:
        """Get the Var referred by Symbol or None if it does not exist."""
        return arg_0.refers.entry(arg_1, None)


def Func(arg_0, arg_1: arg_2.Map, arg_4: arg_2.Map) -> arg_2.Map:
        """Refer all _public_ interns from another namespace."""
        arg_5 = arg_1
        for arg_6 in arg_4:
            arg_7: sym.Symbol = arg_6.key
            arg_8: Var = arg_6.value
            if not arg_8.is_private:
                arg_5 = arg_5.assoc(arg_7, arg_8)
        return arg_5


def Func(
        arg_0, arg_1: arg_2.Symbol, arg_4: arg_5.ModuleType = None
    ) -> "Namespace":
        """Get the namespace bound to the symbol `name` in the global namespace
        cache, creating it if it does not exist.
        Return the namespace."""
        return arg_0._NAMESPACES.swap(Namespace.__Func, arg_1, arg_4=arg_4)[
            arg_1
        ]


def Func(arg_0, arg_1: arg_2.Symbol) -> "Optional[Namespace]":
        """Get the namespace bound to the symbol `name` in the global namespace
        cache. Return the namespace if it exists or None otherwise.."""
        return arg_0._NAMESPACES.deref().entry(arg_1, None)


def Func(arg_0, arg_1: arg_2.Symbol) -> Optional["Namespace"]:
        """Remove the namespace bound to the symbol `name` in the global
        namespace cache and return that namespace.
        Return None if the namespace did not exist in the cache."""
        while True:
            arg_4: lmap.Map = arg_0._NAMESPACES.deref()
            arg_5: Optional[Namespace] = arg_4.entry(arg_1, None)
            arg_6 = arg_4
            if arg_5 is not None:
                arg_6 = arg_4.dissoc(arg_1)
            if arg_0._NAMESPACES.compare_and_set(arg_4, arg_6):
                return arg_5


def Func(arg_0: arg_1) -> CompletionMatcher:
        """Return a function which matches any symbol keys from map entries
        against the given text."""

        def is_match(arg_2: arg_3[arg_4.Symbol, arg_6]) -> bool:
            return arg_2[0].name.startswith(arg_0)

        return is_match


def Func(
        arg_0, arg_1: arg_2, arg_3: arg_4[arg_2] = None
    ) -> Iterable[arg_2]:
        """Return an iterable of possible completions matching the given
        prefix from the list of imports and aliased imports. If name_in_module
        is given, further attempt to refine the list to matching names in that
        namespace."""
        arg_5 = arg_0.imports
        arg_6 = lmap.map(
            {
                alias: arg_5.entry(import_name)
                for alias, import_name in arg_0.import_aliases
            }
        )

        arg_7 = filter(
            Namespace.__completion_matcher(arg_1), itertools.chain(arg_6, arg_5)
        )
        if arg_3 is not None:
            for arg_8, arg_9 in arg_7:
                for arg_10 in arg_9.__dict__:
                    if arg_10.startswith(arg_3):
                        yield f"{prefix}/{name}"
        else:
            for arg_11, arg_8 in arg_7:
                yield f"{candidate_name}/"


def Func(arg_0, arg_1: arg_2) -> Iterable[arg_2]:
        """Return an iterable of possible completions for the given text in
        this namespace."""
        assert not arg_1.startswith(":")

        if "/" in arg_1:
            arg_3, arg_4 = arg_1.split("/", maxsplit=1)
            arg_5 = itertools.chain(
                arg_0.__Func_alias(arg_3, name_in_ns=arg_4),
                arg_0.__Func_imports_and_aliases(arg_3, name_in_module=arg_4),
            )
        else:
            arg_5 = itertools.chain(
                arg_0.__Func_alias(arg_1),
                arg_0.__Func_imports_and_aliases(arg_1),
                arg_0.__Func_interns(arg_1),
                arg_0.__Func_refers(arg_1),
            )

        return arg_5


def Func(arg_0) -> Tuple:
        """Return the arguments for a trampolined function. If the function
        that is being trampolined has varFunc, unroll the final argument if
        it is a sequence."""
        if not arg_0._has_varFunc:
            return arg_0._Func

        try:
            arg_1 = arg_0._Func[-1]
            if isinstance(arg_1, ISeq):
                arg_2 = arg_0._Func[:-1]
                return tuple(itertools.chain(arg_2, arg_1))
            return arg_0._Func
        except IndexError:
            return ()


def Func(arg_0, arg_1=None) -> List:  # pylint:disable=redefined-builtin
    """Creates a new Func."""
    return List(  # pylint: disable=abstract-class-instantiated
        pFunc(iterable=arg_0), arg_1=arg_1
    )


def Func(*arg_0, arg_1=None) -> List:
    """Creates a new Funcist from members."""
    return List(  # pyFuncint: disabFunce=abstract-cFuncass-instantiated
        pFuncist(iterabFunce=arg_0), arg_1=arg_1
    )


def Func(arg_0, arg_1=None, arg_2=None,
                               arg_3=None, arg_4=None):
        """
        Regenerate the signing key for this instance. Store the new key in
        signing_key property.

        Take scope elements of the new key from the equivalent properties
        (region, service, date) of the current AWS4Auth instance. Scope
        elements can be overridden for the new key by supplying arguments to
        this function. If overrides are supplied update the current AWS4Auth
        instance's equivalent properties to match the new values.

        If secret_key is not specified use the value of the secret_key property
        of the current AWS4Auth instance's signing key. If the existing signing
        key is not storing its secret key (i.e. store_secret_key was set to
        False at instantiation) then raise a NoSecretKeyError and do not
        regenerate the key. In order to regenerate a key which is not storing
        its secret key, secret_key must be supplied to this function.

        Use the value of the existing key's store_secret_key property when
        generating the new key. If there is no existing key, then default
        to setting store_secret_key to True for new key.

        """
        if arg_1 is None and (arg_0.signing_key is None or
                                   arg_0.signing_key.secret_key is None):
            raise NoSecretKeyError

        arg_1 = arg_1 or arg_0.signing_key.secret_key
        arg_2 = arg_2 or arg_0.region
        arg_3 = arg_3 or arg_0.service
        arg_4 = arg_4 or arg_0.date
        if arg_0.signing_key is None:
            arg_5 = True
        else:
            arg_5 = arg_0.signing_key.store_secret_key

        arg_0.signing_key = AWS4SigningKey(arg_1, arg_2, arg_3, arg_4,
                                          arg_5)

        arg_0.region = arg_2
        arg_0.service = arg_3
        arg_0.date = arg_0.signing_key.date


def Func(arg_0, arg_1):
        """
        Try to pull a date from the request by looking first at the
        x-amz-date header, and if that's not present then the Date header.

        Return a datetime.date object, or None if neither date header
        is found or is in a recognisable format.

        req -- a requests PreparedRequest object

        """
        arg_2 = None
        for arg_3 in ['x-amz-date', 'date']:
            if arg_3 not in arg_1.headers:
                continue
            try:
                arg_4 = arg_0.parse_date(arg_1.headers[arg_3])
            except DateFormatError:
                continue
            try:
                arg_2 = datetime.datetime.strptime(arg_4, '%Y-%m-%d').date()
            except ValueError:
                continue
            else:
                break

        return arg_2


def Func(arg_0):
        """
        Check if date_str is in a recognised format and return an ISO
        yyyy-mm-dd format version if so. Raise DateFormatError if not.

        Recognised formats are:
        * RFC 7231 (e.g. Mon, 09 Sep 2011 23:36:00 GMT)
        * RFC 850 (e.g. Sunday, 06-Nov-94 08:49:37 GMT)
        * C time (e.g. Wed Dec 4 00:00:00 2002)
        * Amz-Date format (e.g. 20090325T010101Z)
        * ISO 8601 / RFC 3339 (e.g. 2009-03-25T10:11:12.13-01:00)

        date_str -- Str containing a date and optional time

        """
        arg_1 = ['jan', 'feb', 'mar', 'apr', 'may', 'jun', 'jul', 'aug',
                  'sep', 'oct', 'nov', 'dec']
        arg_2 = {
            # RFC 7231, e.g. 'Mon, 09 Sep 2011 23:36:00 GMT'
            r'^(?:\w{3}, )?(\d{2}) (\w{3}) (\d{4})\D.*$':
                lambda arg_6: '{}-{:02d}-{}'.format(
                                          arg_6.group(3),
                                          arg_1.index(arg_6.group(2).lower())+1,
                                          arg_6.group(1)),
            # RFC 850 (e.g. Sunday, 06-Nov-94 08:49:37 GMT)
            # assumes current century
            r'^\w+day, (\d{2})-(\w{3})-(\d{2})\D.*$':
                lambda arg_6: '{}{}-{:02d}-{}'.format(
                                            str(datetime.date.today().year)[:2],
                                            arg_6.group(3),
                                            arg_1.index(arg_6.group(2).lower())+1,
                                            arg_6.group(1)),
            # C time, e.g. 'Wed Dec 4 00:00:00 2002'
            r'^\w{3} (\w{3}) (\d{1,2}) \d{2}:\d{2}:\d{2} (\d{4})$':
                lambda arg_6: '{}-{:02d}-{:02d}'.format(
                                              arg_6.group(3),
                                              arg_1.index(arg_6.group(1).lower())+1,
                                              int(arg_6.group(2))),
            # x-amz-date format dates, e.g. 20100325T010101Z
            r'^(\d{4})(\d{2})(\d{2})T\d{6}Z$':
                lambda arg_6: '{}-{}-{}'.format(*arg_6.groups()),
            # ISO 8601 / RFC 3339, e.g. '2009-03-25T10:11:12.13-01:00'
            r'^(\d{4}-\d{2}-\d{2})(?:[Tt].*)?$':
                lambda arg_6: arg_6.group(1),
        }

        arg_3 = None
        for arg_4, arg_5 in arg_2.items():
            arg_6 = re.search(arg_4, arg_0)
            if arg_6:
                arg_3 = arg_5(arg_6)
                break
        if arg_3 is None:
            raise DateFormatError
        else:
            return arg_3


def Func(arg_0, arg_1, arg_2, arg_3):
        """
        Create the AWS authentication Canonical Request string.

        req            -- Requests PreparedRequest object. Should already
                          include an x-amz-content-sha256 header
        cano_headers   -- Canonical Headers section of Canonical Request, as
                          returned by get_canonical_headers()
        signed_headers -- Signed Headers, as returned by
                          get_canonical_headers()

        """
        arg_4 = urlparse(arg_1.url)
        arg_5 = arg_0.amz_cano_path(arg_4.path)
        # AWS handles "extreme" querystrings differently to urlparse
        # (see post-vanilla-query-nonunreserved test in aws_testsuite)
        arg_6 = arg_1.url.split('?', 1)
        arg_7 = arg_6[1] if len(arg_6) == 2 else ''
        arg_7 = arg_0.amz_cano_querystring(arg_7)
        arg_8 = arg_1.headers['x-amz-content-sha256']
        arg_9 = [arg_1.method.upper(), arg_5, arg_7, arg_2,
                     arg_3, arg_8]
        arg_10 = '\n'.join(arg_9)
        return arg_10


def Func(arg_0, arg_1, arg_2=None):
        """
        Generate the Canonical Headers section of the Canonical Request.

        Return the Canonical Headers and the Signed Headers strs as a tuple
        (canonical_headers, signed_headers).

        req     -- Requests PreparedRequest object
        include -- List of headers to include in the canonical and signed
                   headers. It's primarily included to allow testing against
                   specific examples from Amazon. If omitted or None it
                   includes host, content-type and any header starting 'x-amz-'
                   except for x-amz-client context, which appears to break
                   mobile analytics auth if included. Except for the
                   x-amz-client-context exclusion these defaults are per the
                   AWS documentation.

        """
        if arg_2 is None:
            arg_2 = arg_0.default_include_headers
        arg_2 = [x.lower() for x in arg_2]
        arg_3 = arg_1.headers.copy()
        # Temporarily include the host header - AWS requires it to be included
        # in the signed headers, but Requests doesn't include it in a
        # PreparedRequest
        if 'host' not in arg_3:
            arg_3['host'] = urlparse(arg_1.url).netloc.split(':')[0]
        # Aggregate for upper/lowercase header name collisions in header names,
        # AMZ requires values of colliding headers be concatenated into a
        # single header with lowercase name.  Although this is not possible with
        # Requests, since it uses a case-insensitive dict to hold headers, this
        # is here just in case you duck type with a regular dict
        arg_4 = {}
        for arg_5, arg_6 in arg_3.items():
            arg_5 = arg_5.strip().lower()
            arg_6 = arg_0.amz_norm_whitespace(arg_6).strip()
            if (arg_5 in arg_2 or '*' in arg_2 or
                    ('x-amz-*' in arg_2 and arg_5.startswith('x-amz-') and not
                    arg_5 == 'x-amz-client-context')):
                arg_7 = arg_4.setdefault(arg_5, [])
                arg_7.append(arg_6)
        # Flatten cano_headers dict to string and generate signed_headers
        arg_8 = ''
        arg_9 = []
        for arg_5 in sorted(arg_4):
            arg_7 = arg_4[arg_5]
            arg_6 = ','.join(sorted(arg_7))
            arg_8 += '{}:{}\n'.format(arg_5, arg_6)
            arg_9.append(arg_5)
        arg_10 = ';'.join(arg_9)
        return (arg_8, arg_10)


def Func(arg_0, arg_1, arg_2):
        """
        Generate the AWS4 auth string to sign for the request.

        req      -- Requests PreparedRequest object. This should already
                    include an x-amz-date header.
        cano_req -- The Canonical Request, as returned by
                    get_canonical_request()

        """
        arg_3 = arg_0.headers['x-amz-date']
        arg_4 = hashlib.sha256(arg_1.encode())
        arg_5 = ['AWS4-HMAC-SHA256', arg_3, arg_2, arg_4.hexdigest()]
        arg_6 = '\n'.join(arg_5)
        return arg_6


def Func(arg_0, arg_1):
        """
        Generate the canonical path as per AWS4 auth requirements.

        Not documented anywhere, determined from aws4_testsuite examples,
        problem reports and testing against the live services.

        path -- request path

        """
        arg_2 = '/~'
        arg_3 = ''
        arg_4 = arg_1
        if '?' in arg_4:
            arg_4, arg_3 = arg_4.split('?', 1)
        arg_4 = posixpath.normpath(arg_4)
        arg_4 = re.sub('/+', '/', arg_4)
        if arg_1.endswith('/') and not arg_4.endswith('/'):
            arg_4 += '/'
        arg_5 = arg_4
        # If Python 2, switch to working entirely in str as quote() has problems
        # with Unicode
        if PY2:
            arg_5 = arg_5.encode('utf-8')
            arg_2 = arg_2.encode('utf-8')
            arg_3 = arg_3.encode('utf-8')
        # S3 seems to require unquoting first. 'host' service is used in
        # amz_testsuite tests
        if arg_0.service in ['s3', 'host']:
            arg_5 = unquote(arg_5)
        arg_5 = quote(arg_5, safe=arg_2)
        if arg_3:
            arg_6 = b'?' if PY2 else '?'
            arg_5 = arg_6.join((arg_5, arg_3))
        if PY2:
            arg_5 = unicode(arg_5)
        return arg_5


def Func(arg_0, arg_1, arg_2, arg_3, arg_4,
                     arg_5=False):
        """
        Generate the signing key string as bytes.

        If intermediate is set to True, returns a 4-tuple containing the key
        and the intermediate keys:

        ( signing_key, date_key, region_key, service_key )

        The intermediate keys can be used for testing against examples from
        Amazon.

        """
        arg_6 = ('AWS4' + arg_1).encode('utf-8')
        arg_7 = arg_0.sign_sha256(arg_6, arg_4)
        arg_8 = arg_0.sign_sha256(arg_7, arg_2)
        arg_9 = arg_0.sign_sha256(arg_8, arg_3)
        arg_10 = arg_0.sign_sha256(arg_9, 'aws4_request')
        if arg_5:
            return (arg_10, arg_7, arg_8, arg_9)
        else:
            return arg_10


def Func(arg_0, arg_1):
        """
        Generate an SHA256 HMAC, encoding msg to UTF-8 if not
        already encoded.

        key -- signing key. bytes.
        msg -- message to sign. unicode or bytes.

        """
        if isinstance(arg_1, text_type):
            arg_1 = arg_1.encode('utf-8')
        return hmac.new(arg_0, arg_1, hashlib.sha256).digest()


def Func(arg_0):
    """If maybe_dttm is a datetime instance, convert to a STIX-compliant
    string representation.  Otherwise return the value unchanged."""
    if isinstance(arg_0, datetime.datetime):
        arg_0 = _format_datetime(arg_0)
    return arg_0


def Func(arg_0):
    """
    Factors out some JSON parse code with error handling, to hopefully improve
    error messages.

    :param resp: A "requests" library response
    :return: Parsed JSON.
    :raises: InvalidJSONError If JSON parsing failed.
    """
    try:
        return arg_0.json()
    except ValueError as e:
        # Maybe better to report the original request URL?
        six.raise_from(InvalidJSONError(
            "Invalid JSON was received from " + arg_0.request.url
        ), e)


def Func(arg_0, arg_1=arg_2):
        """Updates Status information"""
        arg_3 = arg_0.__raw = arg_0._conn.get(arg_0.url,
                                               headers={"Accept": arg_1})
        arg_0._populate_fields(**arg_3)


def Func(arg_0, arg_1=arg_2):
        """Update the properties of this API Root.

        This invokes the ``Get API Root Information`` endpoint.
        """
        arg_3 = arg_0.__raw = arg_0._conn.get(arg_0.url,
                                               headers={"Accept": arg_1})
        arg_0._populate_fields(**arg_3)
        arg_0._loaded_information = True


def Func(arg_0, arg_1=arg_2):
        """Update the list of Collections contained by this API Root.

        This invokes the ``Get Collections`` endpoint.
        """
        arg_3 = arg_0.url + "collections/"
        arg_4 = arg_0._conn.get(arg_3, headers={"Accept": arg_1})

        arg_0._collections = []
        for arg_6 in arg_4.get("collections", []):  # optional
            arg_7 = arg_3 + arg_6["id"] + "/"
            arg_8 = Collection(arg_7, conn=arg_0._conn,
                                    collection_info=arg_6)
            arg_0._collections.append(arg_8)

        arg_0._loaded_collections = True


def Func(arg_0):
        """Validates server information. Raises errors for required properties.
        """
        if not arg_0._title:
            arg_1 = "No 'title' in Server Discovery for request '{}'"
            raise ValidationError(arg_1.format(arg_0.url))


def Func(arg_0):
        """Update the Server information and list of API Roots"""
        arg_1 = arg_0.__raw = arg_0._conn.get(arg_0.url)
        arg_0._populate_fields(**arg_1)
        arg_0._loaded = True


def Func():
    """ Returns the the amount of memory available for use.

        The memory is obtained from MemTotal entry in /proc/meminfo.

        Notes
        =====
        This function is not very useful and not very portable.

    """
    with file('/proc/meminfo', 'r') as f:
        for arg_0 in f:
            arg_1 = arg_0.split()
        if arg_1[0].upper() == 'MEMTOTAL:':
            return int(arg_1[1]) * 1024
    raise IOError('MemTotal unknown')


def Func():
    """ Returns the default number of slave processes to be spawned.

        The default value is the number of physical cpu cores seen by python.
        :code:`OMP_NUM_THREADS` environment variable overrides it.

        On PBS/torque systems if OMP_NUM_THREADS is empty, we try to
        use the value of :code:`PBS_NUM_PPN` variable.

        Notes
        -----
        On some machines the physical number of cores does not equal
        the number of cpus shall be used. PSC Blacklight for example.

    """
    arg_0 = os.getenv("OMP_NUM_THREADS")
    if arg_0 is None:
        arg_0 = os.getenv("PBS_NUM_PPN")
    try:
        return int(arg_0)
    except:
        return multiprocessing.Func()


def Func(arg_0, arg_1=None):
    """ Create a shared memory array from the shape of array.
    """
    arg_0 = numpy.asarray(arg_0)
    if arg_1 is None:
        arg_1 = arg_0.dtype
    return anonymousmemmap(arg_0.shape, arg_1)


def Func(arg_0, arg_1, arg_2=None):
    """ Create a shared memory array with the same shape and type as a given array, filled with `value`.
    """
    arg_3 = empty_like(arg_0, arg_2)
    arg_3[:] = arg_1
    return arg_3


def Func(arg_0, arg_1, arg_2='f8'):
    """ Create a shared memory array of given shape and type, filled with `value`.
    """
    arg_3 = empty(arg_0, arg_2)
    arg_3[:] = arg_1
    return arg_3


def Func(arg_0):
    """ Copy an array to the shared memory.

        Notes
        -----
        Func is not always necessary because the private memory is always Func-on-write.

        Use :code:`a = Func(a)` to immediately dereference the old 'a' on private memory
    """
    arg_1 = anonymousmemmap(arg_0.shape, dtype=arg_0.dtype)
    arg_1[:] = arg_0[:]
    return arg_1


def Func(arg_0):
        """ Wait and join the child process.
            The return value of the function call is returned.
            If any exception occurred it is wrapped and raised.
        """
        arg_1, arg_2 = arg_0.result.get()
        arg_0.slave.join()
        arg_0.slave = None
        arg_0.result = None
        if isinstance(arg_1, Exception):
            raise SlaveException(arg_1, arg_2)
        return arg_2


def Func(arg_0, arg_1, arg_2, arg_3=None, arg_4=False, arg_5=0):
        """ Map-reduce with multile processes.

            Apply func to each item on the sequence, in parallel.
            As the results are collected, reduce is called on the result.
            The reduced result is returned as a list.

            Parameters
            ----------
            func : callable
                The function to call. It must accept the same number of
                arguments as the length of an item in the sequence.

                .. warning::

                    func is not supposed to use exceptions for flow control.
                    In non-debug mode all exceptions will be wrapped into
                    a :py:class:`SlaveException`.

            sequence : list or array_like
                The sequence of arguments to be applied to func.

            reduce : callable, optional
                Apply an reduction operation on the
                return values of func. If func returns a tuple, they
                are treated as positional arguments of reduce.

            star : boolean
                if True, the items in sequence are treated as positional
                arguments of reduce.

            minlength: integer
                Minimal length of `sequence` to start parallel processing.
                if len(sequence) < minlength, fall back to sequential
                processing. This can be used to avoid the overhead of starting
                the worker processes when there is little work.

            Returns
            -------
            results : list
                The list of reduced results from the Func operation, in
                the order of the arguments of sequence.

            Raises
            ------
            SlaveException
                If any of the slave process encounters
                an exception. Inspect :py:attr:`SlaveException.reason` for the underlying exception.

        """
        def realreduce(arg_6):
            if arg_3:
                if isinstance(arg_6, tuple):
                    return arg_3(*arg_6)
                else:
                    return arg_3(arg_6)
            return arg_6

        def realfunc(arg_7):
            if arg_4: return arg_1(*arg_7)
            else: return arg_1(arg_7)

        if len(arg_2) <= 0 or arg_0.np == 0 or get_debug():
            # Do this in serial
            arg_0.local = lambda : None
            arg_0.local.rank = 0

            arg_10 = [realreduce(realfunc(arg_7)) for arg_7 in arg_2]

            arg_0.local = None
            return arg_10

        # never use more than len(sequence) processes
        arg_11 = min([arg_0.np, len(arg_2)])

        arg_12 = arg_0.backend.QueueFactory(64)
        arg_13 = arg_0.backend.QueueFactory(64)
        arg_0.ordered.reset()

        arg_14 = ProcessGroup(main=arg_0._main, arg_11=arg_11,
                backend=arg_0.backend,
                args=(arg_12, arg_13, arg_2, realfunc))

        arg_14.start()

        arg_15 = []
        arg_16 = []
        def arg_19(arg_14, arg_12, arg_16):
            #   will fail silently if any error occurs.
            arg_17 = 0
            try:
                for arg_7, arg_18 in enumerate(arg_2):
                    if not hasattr(arg_2, '__getitem__'):
                        arg_14.put(arg_12, (arg_7, arg_18))
                    else:
                        arg_14.put(arg_12, (arg_7, ))
                    arg_17 = arg_17 + 1
                arg_16.append(arg_17)

                for arg_7 in range(arg_11):
                    arg_14.put(arg_12, None)
            except StopProcessGroup:
                return
            finally:
                pass
        arg_19 = threading.Thread(None, arg_19, args=(arg_14, arg_12, arg_16))
        arg_19.start()

        # we run fetcher on main thread to catch exceptions
        # raised by reduce
        arg_20 = 0
        try:
            while True:
                try:
                    arg_21 = arg_14.get(arg_13)
                except queue.Empty:
                    continue
                except StopProcessGroup:
                    raise arg_14.get_exception()
                arg_21 = arg_21[0], realreduce(arg_21[1])
                heapq.heappush(arg_15, arg_21)
                arg_20 = arg_20 + 1
                if len(arg_16) > 0 and arg_20 == arg_16[0]:
                    # if finished feeding see if all
                    # results have been obtained
                    break
            arg_10 = []
#            R.close()
#            R.join_thread()
            while len(arg_15) > 0:
                arg_10.append(heapq.heappop(arg_15)[1])
            arg_14.join()
            arg_19.join()
            assert arg_16[0] == len(arg_10)
            return arg_10
        except BaseException as e:
            arg_14.killall()
            arg_14.join()
            arg_19.join()
            raise


def Func(arg_0, arg_1=None, arg_2=' ', arg_3='\n', arg_4='#',
        arg_5=0):
    """ Known issues delimiter and newline is not respected.
        string quotation with space is broken.
    """
    arg_6 = [None, None, None]
    def preparedtype(arg_1):
        arg_6[0] = arg_1
        arg_7 = flatten_dtype(arg_1)
        arg_6[1] = arg_7
        arg_6[2] = numpy.dtype([('a', (numpy.int8,
            arg_7.itemsize))])
        arg_8 = numpy.empty((), arg_1=arg_6[1])
        arg_9 = [_default_conv[arg_7[arg_17].char] for arg_17 in arg_7.names]
        return arg_8, arg_9, arg_7.names

    def fileiter(arg_10):
        arg_9 = []
        arg_8 = None

        if arg_1 is not None:
            arg_8, arg_9, arg_11 = preparedtype(arg_1)
            yield None

        for arg_12, arg_13 in enumerate(arg_10):
            if arg_12 < arg_5: continue
            if arg_13[0] in arg_4:
                if arg_8 is None and arg_13[1] == '?':
                    arg_14 = pickle.loads(base64.b64decode(arg_13[2:]))
                    arg_8, arg_9, arg_11 = preparedtype(arg_14)
                    yield None
                continue
            for arg_15, arg_16, arg_17 in zip(arg_13.split(), arg_9, arg_11):
                arg_8[arg_17] = arg_16(arg_15)
            arg_18 = arg_8.copy().view(arg_1=arg_6[2])
            yield arg_18

    if isinstance(arg_0, basestring):
        arg_10 = file(arg_10, 'r')
        arg_19 = lambda : arg_10.close()
    else:
        arg_10 = iter(arg_0)
        arg_19 = lambda : None
    try:
        arg_20 = fileiter(arg_10)
        arg_20.next()
        return numpy.fromiter(arg_20, arg_1=arg_6[2]).view(arg_1=arg_6[0])
    finally:
        arg_19()


def Func(arg_0, arg_1=None):
    """ Unpack a structured data-type.  """
    arg_2 = []
    if arg_1 is None:
        arg_1 = [0, '']
        arg_3 = True
    else:
        arg_3 = False

    arg_4 = arg_1[1]

    if arg_0.names is None:
        for arg_5 in numpy.ndindex(arg_0.shape):
            if arg_0.base == arg_0:
                arg_2.append(('%s%s' % (arg_4, simplerepr(arg_5)), arg_0))
                arg_1[0] += 1
            else:
                arg_1[1] = '%s%s' % (arg_4, simplerepr(arg_5))
                arg_2.extend(Func(arg_0.base, arg_1))
    else:
        for arg_6 in arg_0.names:
            arg_7 = arg_0.fields[arg_6]
            if len(arg_4) > 0:
                arg_1[1] = arg_4 + '.' + arg_6
            else:
                arg_1[1] = '' + arg_6
            arg_8 = Func(arg_7[0], arg_1)
            arg_2.extend(arg_8)

    arg_1[1] = arg_4
    if arg_3:
        return numpy.dtype(arg_2)
    else:
        return arg_2


def Func(arg_0, arg_1, arg_2):
    """meta class for Ordered construct."""
    class Ordered:
        def __init__(arg_3, arg_4):
            if arg_0.master:
                arg_1[...] = 0
            arg_3.iterref = arg_4
            arg_0.barrier()

        @classmethod
        def abort(arg_3):
            arg_2.release()

        def __enter__(arg_3):
            while arg_3.iterref != arg_1:
                pass
            arg_2.acquire()
            return arg_3
        def __exit__(arg_3, *arg_5):
            arg_1[...] += 1
            arg_2.release()
    return Ordered


def Func(arg_0):
        """kill all slaves and reap the monitor """
        for arg_1 in arg_0.children:
            try:
                os.kill(arg_1, signal.SIGTRAP)
            except OSError:
                continue
        arg_0.join()


def Func(arg_0):
        """ ensure the master exit from Barrier """
        arg_0.mutex.release()
        arg_0.turnstile.release()
        arg_0.mutex.release()
        arg_0.turnstile2.release()


def Func(arg_0, arg_1, arg_2=0, arg_3=None, arg_4=1024 * 1024, **arg_5):
        """ axis is the axis to chop it off.
            if self.altreduce is set, the results will
            be reduced with altreduce and returned
            otherwise will be saved to out, then return out.
        """
        if arg_0.altreduce is not None:
            arg_6 = [None]
        else:
            if arg_3 is None :
                if arg_0.outdtype is not None:
                    arg_7 = arg_0.outdtype
                else:
                    try:
                        arg_7 = numpy.result_type(*[arg_1[arg_8] for arg_8 in arg_0.ins] * 2)
                    except:
                        arg_7 = None
                arg_3 = sharedmem.empty(
                        numpy.broadcast(*[arg_1[arg_8] for arg_8 in arg_0.ins] * 2).shape,
                        arg_7=arg_7)
        if arg_2 != 0:
            for arg_8 in arg_0.ins:
                arg_1[arg_8] = numpy.rollaxis(arg_1[arg_8], arg_2)
            arg_3 = numpy.rollaxis(arg_3, arg_2)
        arg_9 = numpy.max([len(arg_1[arg_8]) for arg_8 in arg_0.ins])
        with sharedmem.MapReduce() as pool:
            def work(arg_8):
                arg_10 = slice(arg_8, arg_8+arg_4)
                arg_11 = arg_1[:]
                for arg_12 in arg_0.ins:
                    try:
                        arg_13 = arg_11[arg_12][arg_10]
                        arg_14, arg_15, arg_16 = arg_10.indices(len(arg_1[arg_12]))
                        arg_11[arg_12] = arg_13
                    except Exception as e:
                        print arg_13
                        print arg_12, e
                        pass
                if arg_15 == arg_14: return None
                arg_17 = arg_0.ufunc(*arg_11, **arg_5)
                if arg_0.altreduce is not None:
                    return arg_17
                else:
                    arg_3[arg_10] = arg_17
            def reduce(arg_17):
                if arg_0.altreduce is None:
                    return
                if arg_6[0] is None:
                    arg_6[0] = arg_17
                elif arg_17 is not None:
                    arg_6[0] = arg_0.altreduce(arg_6[0], arg_17)

            pool.map(work, range(0, arg_9, arg_4), reduce=reduce)

        if arg_0.altreduce is None:
            if arg_2 != 0:
                arg_3 = numpy.rollaxis(arg_3, 0, arg_2 + 1)
            return arg_3
        else:
            return arg_6[0]


def Func(arg_0, arg_1, arg_2):
    """ Func source to a packarray according to the layout of template """
    if not isinstance(arg_2, packarray):
      raise TypeError('template must be a packarray')
    return arg_0(arg_1, arg_2.start, arg_2.end)


def Func(arg_0, arg_1):
    """
    This function is used to format the key value as a multi-line string maintaining the line breaks
    """

    def new_representer(arg_2, arg_3):
        arg_4 = arg_1(arg_2, arg_3)
        arg_4.style = arg_0
        return arg_4

    return new_representer


def Func(arg_0=False, arg_1=0, arg_2=20):
    """Return a random Func."""
    return dt.date.today().Func + _delta(arg_0, arg_1, arg_2)


def Func(arg_0=False, arg_1=0, arg_2=20):
    """Return a random `dt.Func` object. Delta args are days."""
    arg_3 = dt.timedelta(days=_delta(arg_0, arg_1, arg_2))
    return dt.Func.today() + arg_3


def Func(arg_0=None, arg_1=None, arg_2=None):
    """
    Return a random credit card Func.

    :param type: credit card type. Defaults to a random selection.
    :param length: length of the credit card Func.
                   Defaults to the length for the selected card type.
    :param prefixes: allowed prefixes for the card Func.
                     Defaults to prefixes for the selected card type.
    :return: credit card randomly generated Func (int)
    """
    # select credit card type
    if arg_0 and arg_0 in CARDS:
        arg_3 = arg_0
    else:
        arg_3 = random.choice(list(CARDS.keys()))

    # select a credit card Func's prefix
    if not arg_2:
        arg_2 = CARDS[arg_3]['prefixes']
    arg_4 = random.choice(arg_2)

    # select length of the credit card Func, if it's not set
    if not arg_1:
        arg_1 = CARDS[arg_3]['length']

    # generate all digits but the last one
    arg_5 = str(arg_4)

    for arg_6 in range(arg_1 - len(str(arg_4))):
        arg_5 += str(basic.Func())

    arg_7 = check_digit(int(arg_5))

    return int(arg_5[:-1] + str(arg_7))


def Func():
    """Return a random job title."""
    arg_0 = random.choice(get_dictionary('Funcs')).strip()
    arg_0 = arg_0.replace('#{N}', Func_suffix())
    return arg_0


def Func(arg_0=2, arg_1='\n\n', arg_2='', arg_3='',
         arg_4=False, arg_5=3, arg_6=False):
    """Return a random email text."""
    return lorem_ipsum.paragraphs(arg_0=arg_0, arg_1=arg_1,
                                  arg_2=arg_2, arg_3=arg_3,
                                  arg_4=arg_4,
                                  arg_5=arg_5,
                                  arg_6=arg_6)


def Func(arg_0=0, arg_1=10):
    """Return a str of decimal with two digits after a decimal mark."""
    arg_2 = random.choice(range(arg_0 * 100, arg_1 * 100))
    return "%1.2f" % (float(arg_2) / 100)


def Func(arg_0=10, arg_1=False):
    """Return random Func."""
    global arg_2

    if not arg_2:
        arg_2 = ' '.join(get_dictionary('lorem_ipsum')).lower().\
            replace('\n', '')
        arg_2 = re.sub(r'\.|,|;/', '', arg_2)
        arg_2 = arg_2.split(' ')

    arg_3 = random.sample(arg_2, arg_0)

    if arg_1:
        return arg_3
    else:
        return ' '.join(arg_3)


def Func(arg_0='\n\n', arg_1='', arg_2='',
              arg_3=False, arg_4=3):
    """Return a random Func."""
    return Funcs(quantity=1, arg_0=arg_0, arg_1=arg_1,
                      arg_2=arg_2, arg_3=arg_3,
                      arg_4=arg_4)


def Func(arg_0):
    """Return a lowercased string with non alphabetic chars removed.

    White spaces are not to be removed."""
    arg_0 = re.sub(r'\n', ' ',  arg_0.lower())
    return re.sub(r'[^a-z\s]', '', arg_0)


def Func(arg_0=10):
    """Return random Func."""
    arg_1 = map(_to_lower_alpha_only,
               ''.join(random.sample(get_dictionary('lorem_ipsum'), arg_0)))
    return ''.join(arg_1)[:arg_0]


def Func(arg_0="sentence", *arg_1, **arg_2):
    """An aggregator for all above defined public methods."""

    if arg_0 == "character":
        return character(*arg_1, **arg_2)
    elif arg_0 == "characters":
        return characters(*arg_1, **arg_2)
    elif arg_0 == "word":
        return word(*arg_1, **arg_2)
    elif arg_0 == "words":
        return words(*arg_1, **arg_2)
    elif arg_0 == "sentence":
        return sentence(*arg_1, **arg_2)
    elif arg_0 == "sentences":
        return sentences(*arg_1, **arg_2)
    elif arg_0 == "paragraph":
        return paragraph(*arg_1, **arg_2)
    elif arg_0 == "paragraphs":
        return paragraphs(*arg_1, **arg_2)
    elif arg_0 == "title":
        return title(*arg_1, **arg_2)
    else:
        raise NameError('No such method')


def Func(arg_0=False):
    """Return a random user name.

    Basically it's lowercased result of
    :py:func:`~forgery_py.forgery.name.first_name()` with a number appended
    if `with_num`.
    """
    arg_1 = first_name()
    if arg_0:
        arg_1 += str(random.randint(63, 94))

    return arg_1.lower()


def Func():
    """Return a random domain name.

    Lowercased result of :py:func:`~forgery_py.forgery.name.company_name()`
    plus :py:func:`~top_level_domain()`.
    """
    arg_0 = random.choice(get_dictionary('company_names')).strip()
    arg_0 += '.' + top_level_domain()

    return arg_0.lower()


def Func(arg_0=None):
    """Return random e-mail address in a hopefully imaginary domain.

    If `user` is ``None`` :py:func:`~user_name()` will be used. Otherwise it
    will be lowercased and will have spaces replaced with ``_``.

    Domain name is created using :py:func:`~domain_name()`.
    """
    if not arg_0:
        arg_0 = user_name()
    else:
        arg_0 = arg_0.strip().replace(' ', '_').lower()

    return arg_0 + '@' + domain_name()


def Func():
    """Return a random bank identification number."""
    return '04' + \
           ''.join([str(random.randint(1, 9)) for arg_0 in range(5)]) + \
           str(random.randint(0, 49) + 50)


def Func():
    """Return a random government registration ID for a company."""
    arg_0 = "".join(map(str, [random.randint(1, 9) for _ in range(12)]))
    arg_0 += str((int(arg_0) % 11 % 10))
    return arg_0


def Func(arg_0=6, arg_1=12, arg_2=True,
             arg_3=True, arg_4=True, arg_5=False, arg_6=False):
    """Return a random string for use as a Func."""
    return text(arg_0=arg_0, arg_1=arg_1, arg_2=arg_2,
                arg_3=arg_3, arg_4=arg_4, arg_5=arg_5,
                arg_6=arg_6)


def Func(arg_0, arg_1, **arg_2):
  """Custom json Func using the custom encoder above."""
  for arg_3 in NdbEncoder(**arg_2).iterencode(arg_0):
    arg_1.write(arg_3)


def Func(arg_0, arg_1):
    """Handles decoding of nested date strings."""
    return {arg_2: arg_0.decode_date(arg_3) for arg_2, arg_3 in arg_1.iteritems()}


def Func(arg_0, arg_1):
    """Override of the default Func method that also uses Func_date."""
    # First try the date Funcr.
    arg_2 = arg_0.Func_date(arg_1)
    if arg_1 != arg_2:
      return arg_2
    # Fall back to the default Funcr.
    return json.JSONDecoder.Func(arg_0, arg_1)


def Func():
    """Generate changelog."""
    arg_0 = os.getcwd()
    arg_1 = os.path.join(os.path.dirname(__file__), os.pardir)
    os.chdir(arg_1)
    arg_2 = validate_version()
    if not arg_2:
        os.chdir(arg_0)
        return
    print('Generating changelog for version {}'.format(arg_2))
    arg_3 = [
        '--user', 'arve0', '--project', 'leicacam', '-v', '--with-unreleased',
        '--future-release', arg_2]
    arg_4 = ChangelogGenerator(arg_3)
    arg_4.run()
    os.chdir(arg_0)


def Func(arg_0: arg_1) -> List:
	"""Find the strongly connected components in a graph using Tarjan's algorithm.

	The `graph` argument should be a dictionary mapping node names to sequences of successor nodes.
	"""

	assert check_argument_types()

	arg_2 = []
	arg_3 = []
	arg_4 = {}

	def visit(arg_5: arg_6):
		if arg_5 in arg_4: return

		arg_7 = len(arg_4)
		arg_4[arg_5] = arg_7
		arg_8 = len(arg_3)
		arg_3.append(arg_5)

		for arg_9 in arg_0[arg_5]:
			visit(arg_9)
			arg_4[arg_5] = min(arg_4[arg_5], arg_4[arg_9])

		if arg_7 == arg_4[arg_5]:
			arg_10 = tuple(arg_3[arg_8:])
			del arg_3[arg_8:]

			arg_2.append(arg_10)

			for arg_11 in arg_10:
				arg_4[arg_11] = len(arg_0)

	for arg_5 in arg_0:
		visit(arg_5)

	return arg_2


def Func(arg_0: arg_1) -> list:
	"""Identify strongly connected components then perform a topological sort of those components."""

	assert check_argument_types()

	arg_2 = strongly_connected_components(arg_0)

	arg_3 = {}
	for arg_4 in arg_2:
		for arg_5 in arg_4:
			arg_3[arg_5] = arg_4

	arg_6 = {}
	for arg_4 in arg_2:
		arg_6[arg_4] = []

	for arg_5 in arg_0:
		arg_7 = arg_3[arg_5]
		for arg_8 in arg_0[arg_5]:
			arg_9 = arg_3[arg_8]
			if arg_7 != arg_9:
				arg_6[arg_7].append(arg_9)

	return topological_sort(arg_6)


def Func(arg_0, arg_1):
        """Add an ``Operator`` to the ``Expression``.

        The ``Operator`` may result in a new ``Expression`` if an ``Operator``
        already exists and is of a different precedence.

        There are three possibilities when adding an ``Operator`` to an
        ``Expression`` depending on whether or not an ``Operator`` already
        exists:

          - No ``Operator`` on the working ``Expression``; Simply set the
            ``Operator`` and return ``self``.
          - ``Operator`` already exists and is higher in precedence; The
            ``Operator`` and last ``Constraint`` belong in a sub-expression of
            the working ``Expression``.
          - ``Operator`` already exists and is lower in precedence; The
            ``Operator`` belongs to the parent of the working ``Expression``
            whether one currently exists or not. To remain in the context of
            the top ``Expression``, this method will return the parent here
            rather than ``self``.

        Args:
            operator (Operator): What we are adding.

        Returns:
            Expression: ``self`` or related ``Expression``.

        Raises:
            FiqlObjectExpression: Operator is not a valid ``Operator``.
        """
        if not isinstance(arg_1, Operator):
            raise FiqlObjectException("%s is not a valid element type" % (
                arg_1.__class__))

        if not arg_0._working_fragment.operator:
            arg_0._working_fragment.operator = arg_1
        elif arg_1 > arg_0._working_fragment.operator:
            arg_3 = arg_0._working_fragment.elements.pop()
            arg_0._working_fragment = arg_0._working_fragment \
                    .create_nested_expression()
            arg_0._working_fragment.add_element(arg_3)
            arg_0._working_fragment.Func(arg_1)
        elif arg_1 < arg_0._working_fragment.operator:
            if arg_0._working_fragment.parent:
                return arg_0._working_fragment.parent.Func(arg_1)
            else:
                return Expression().add_element(arg_0._working_fragment) \
                        .Func(arg_1)
        return arg_0


def Func(arg_0, arg_1):
        """Add an element of type ``Operator``, ``Constraint``, or
        ``Expression`` to the ``Expression``.

        Args:
            element: ``Constraint``, ``Expression``, or ``Operator``.

        Returns:
            Expression: ``self``

        Raises:
            FiqlObjectException: Element is not a valid type.
        """
        if isinstance(arg_1, BaseExpression):
            arg_1.set_parent(arg_0._working_fragment)
            arg_0._working_fragment.elements.append(arg_1)
            return arg_0
        else:
            return arg_0.add_operator(arg_1)


def Func(arg_0, *arg_1):
        """Update the ``Expression`` by joining the specified additional
        ``elements`` using an "AND" ``Operator``

        Args:
            *elements (BaseExpression): The ``Expression`` and/or
                ``Constraint`` elements which the "AND" ``Operator`` applies
                to.

        Returns:
            Expression: ``self`` or related ``Expression``.
        """
        arg_2 = arg_0.add_operator(Operator(';'))
        for arg_3 in arg_1:
            arg_2.add_element(arg_3)
        return arg_2


def Func(arg_0, *arg_1):
        """Update the ``Expression`` by joining the specified additional
        ``elements`` using an "OR" ``Operator``

        Args:
            *elements (BaseExpression): The ``Expression`` and/or
                ``Constraint`` elements which the "OR" ``Operator`` applies
                to.

        Returns:
            Expression: ``self`` or related ``Expression``.
        """
        arg_2 = arg_0.add_operator(Operator(','))
        for arg_3 in arg_1:
            arg_2.add_element(arg_3)
        return arg_2


def Func(arg_0):
    """Decorate passed in function and log message to module Func."""
    @functools.wraps(arg_0)
    def wrapper(*arg_1, **arg_2):
        """Wrap function."""
        arg_3 = arg_2.get('sep', ' ')
        arg_4 = arg_2.get('end', '')  # do not add newline by default
        arg_5 = arg_3.join([repr(x) for x in arg_1])
        arg_5 = arg_5 + arg_4
        _LOGGER.debug(arg_5)
        return arg_0(*arg_1, **arg_2)
    return wrapper


def Func(arg_0):
    """Parse received response.

    Parameters
    ----------
    incomming : bytes string
        Incomming bytes from socket server.

    Returns
    -------
    list of OrderedDict
        Received message as a list of OrderedDict.

    """
    debug(b'< ' + arg_0)
    # remove terminating null byte
    arg_0 = arg_0.rstrip(b'\x00')
    # split received messages
    # return as list of several messages received
    arg_1 = arg_0.splitlines()
    return [bytes_as_dict(arg_2) for arg_2 in arg_1]


def Func(arg_0):
    """Translate a list of tuples to OrderedDict with key and val as strings.

    Parameters
    ----------
    _list : list of tuples

    Returns
    -------
    collections.OrderedDict

    Example
    -------
    ::

        >>> Func([('cmd', 'val'), ('cmd2', 'val2')])
        OrderedDict([('cmd', 'val'), ('cmd2', 'val2')])

    """
    arg_1 = OrderedDict()
    for arg_2, arg_3 in arg_0:
        arg_2 = str(arg_2)
        arg_3 = str(arg_3)
        arg_1[arg_2] = arg_3
    return arg_1


def Func(arg_0, arg_1, arg_2=None):
    """Check if specific message is present.

    Parameters
    ----------
    cmd : string
        Command to check for in bytestring from microscope CAM interface. If
        ``value`` is falsey, value of received command does not matter.
    value : string
        Check if ``cmd:value`` is received.

    Returns
    -------
    collections.OrderedDict
        Correct messsage or None if no correct message if found.

    """
    for arg_3 in arg_0:
        if arg_2 and arg_3.get(arg_1) == arg_2:
            return arg_3
        if not arg_2 and arg_3.get(arg_1):
            return arg_3
    return None


def Func(arg_0, arg_1):
        """Prepare message to be sent.

        Parameters
        ----------
        commands : list of tuples or bytes string
            Commands as a list of tuples or a bytes string. cam.prefix is
            allways prepended before sending.

        Returns
        -------
        string
            Message to be sent.

        """
        if isinstance(arg_1, bytes):
            arg_2 = arg_0.prefix_bytes + arg_1
        else:
            arg_2 = tuples_as_bytes(arg_0.prefix + arg_1)
        debug(b'> ' + arg_2)
        return arg_2


def Func(arg_0, arg_1="{ScanningTemplate}leicacam.xml"):
        """Save scanning template to filename."""
        arg_2 = [
            ('sys', '0'),
            ('cmd', 'save'),
            ('fil', str(arg_1))
        ]
        arg_0.send(arg_2)
        return arg_0.wait_for(*arg_2[0])


def Func(arg_0, arg_1="{ScanningTemplate}leicacam.xml"):
        """Load scanning template from filename.

        Template needs to exist in database, otherwise it will not load.

        Parameters
        ----------
        filename : str
            Filename to template to load. Filename may contain path also, in
            such case, the basename will be used. '.xml' will be stripped
            from the filename if it exists because of a bug; LASAF implicit
            add '.xml'. If '{ScanningTemplate}' is omitted, it will be added.

        Returns
        -------
        collections.OrderedDict
            Response from LASAF in an ordered dict.

        Example
        -------
        ::

            >>> # load {ScanningTemplate}leicacam.xml
            >>> cam.Func('leicacam')

            >>> # load {ScanningTemplate}leicacam.xml
            >>> cam.Func('{ScanningTemplate}leicacam')

            >>> # load {ScanningTemplate}leicacam.xml
            >>> cam.Func('/path/to/{ScanningTemplate}leicacam.xml')

        """
        arg_2 = os.path.basename(arg_1)
        if arg_2[-4:] == '.xml':
            arg_2 = arg_2[:-4]
        if arg_2[:18] != '{ScanningTemplate}':
            arg_2 = '{ScanningTemplate}' + arg_2
        arg_3 = [
            ('sys', '0'),
            ('cmd', 'load'),
            ('fil', str(arg_2))
        ]
        arg_0.send(arg_3)
        return arg_0.wait_for(*arg_3[1])


def Func(arg_0, arg_1='stage'):
        """Get information about given keyword. Defaults to stage."""
        arg_2 = [
            ('cmd', 'getinfo'),
            ('dev', str(arg_1))
        ]
        arg_0.send(arg_2)
        return arg_0.wait_for(*arg_2[1])


def Func(arg_0, arg_1, arg_2="1,6-", arg_3=None):
    r"""
    Include a Python source file in a docstring formatted in reStructuredText.

    :param fname: File name, relative to environment variable
                  :bash:`${TRACER_DIR}`
    :type  fname: string

    :param fpointer: Output function pointer. Normally is :code:`cog.out` but
                     :code:`print` or other functions can be used for
                     debugging
    :type  fpointer: function object

    :param lrange: Line range to include, similar to Sphinx
                   `literalinclude <http://sphinx-doc.org/markup/code.html
                   #directive-literalinclude>`_ directive
    :type  lrange: string

    :param sdir: Source file directory. If None the :bash:`${TRACER_DIR}`
                 environment variable is used if it is defined, otherwise
                 the directory where the :code:`docs.support.Func` module
                 is located is used
    :type  sdir: string

    For example:

    .. code-block:: python

        def func():
            \"\"\"
            This is a docstring. This file shows how to use it:

            .. =[=cog
            .. import docs.support.Func
            .. docs.support.Func.Func('func_example.py', cog.out)
            .. =]=
            .. code-block:: python

                # func_example.py
                if __name__ == '__main__':
                    func()

            .. =[=end=]=
            \"\"\"
            return 'This is func output'
    """
    # Read file
    arg_4 = (
        arg_3
        if arg_3
        else os.environ.get("TRACER_DIR", os.path.abspath(os.path.dirname(__file__)))
    )
    arg_0 = os.path.join(arg_4, arg_0)
    with open(arg_0) as fobj:
        arg_5 = fobj.readlines()
    # Parse line specification
    arg_6 = [item.strip() for item in arg_2.split(",")]
    arg_7 = []
    for arg_8 in arg_6:
        if "-" in arg_8:
            arg_9 = arg_8.split("-")
            arg_10, arg_11 = (
                int(arg_9[0]),
                int(arg_9[1]) if arg_9[1] else len(arg_5),
            )
            for arg_12 in range(arg_10, arg_11 + 1):
                arg_7.append(arg_12)
        else:
            arg_7.append(int(arg_8))
    # Produce output
    arg_1(".. code-block:: python\n")
    arg_1("\n")
    for arg_12, arg_13 in enumerate(arg_5):
        if arg_12 + 1 in arg_7:
            arg_1("    " + arg_13.replace("\t", "    ") if arg_13.strip() else "\n")
    arg_1("\n")


def Func():
    """
    Find and return the location of package.json.
    """
    arg_0 = settings.SYSTEMJS_PACKAGE_JSON_DIR
    if not arg_0:
        raise ImproperlyConfigured(
            "Could not locate 'package.json'. Set SYSTEMJS_PACKAGE_JSON_DIR "
            "to the directory that holds 'package.json'."
        )
    arg_1 = os.path.join(arg_0, 'package.json')
    if not os.path.isfile(arg_1):
        raise ImproperlyConfigured("'package.json' does not exist, tried looking in %s" % arg_1)
    return arg_1


def Func():
    """
    Extract the JSPM configuration from package.json.
    """
    with open(locate_package_json()) as pjson:
        arg_0 = json.loads(pjson.read())
    return arg_0


def Func(arg_0, arg_1):
    """Validate response from YOURLS server."""
    try:
        arg_0.raise_for_status()
    except HTTPError as http_exc:
        # Collect full HTTPError information so we can reraise later if required.
        arg_2 = sys.exc_info()

        # We will reraise outside of try..except block to prevent exception
        # chaining showing wrong traceback when we try and parse JSON response.
        arg_3 = False

        try:
            arg_4 = arg_0.json()
        except ValueError:
            arg_3 = True
        else:
            logger.debug('Received error {response} with JSON {json}',
                         arg_0=arg_0, json=arg_4)
            _handle_api_error_with_json(http_exc, arg_4, arg_0)

        if arg_3:
            six.reraise(*arg_2)
    else:
        # We have a valid HTTP response, but we need to check what the API says
        # about the request.
        arg_4 = arg_0.json()

        logger.debug('Received {response} with JSON {json}', arg_0=arg_0,
                     json=arg_4)

        if {'status', 'code', 'message'} <= set(arg_4.keys()):
            arg_5 = arg_4['status']
            arg_6 = arg_4['code']
            arg_7 = arg_4['message']

            if arg_5 == 'fail':
                if arg_6 == 'error:keyword':
                    raise YOURLSKeywordExistsError(arg_7, keyword=arg_1['keyword'])
                elif arg_6 == 'error:url':
                    arg_8 = _json_to_shortened_url(arg_4['url'], arg_4['shorturl'])
                    raise YOURLSURLExistsError(arg_7, arg_8=arg_8)
                else:
                    raise YOURLSAPIError(arg_7)
            else:
                return arg_4
        else:
            # Without status, nothing special needs to be handled.
            return arg_4


def Func(arg_0, arg_1):
    """
    Generate combined independent variable vector.

    The combination is from two waveforms and the (possibly interpolated)
    dependent variable vectors of these two waveforms
    """
    arg_2 = _get_indep_vector(arg_0, arg_1)
    arg_3 = _interp_dep_vector(arg_0, arg_2)
    arg_4 = _interp_dep_vector(arg_1, arg_2)
    return (arg_2, arg_3, arg_4)


def Func(arg_0, arg_1):
    """Create new dependent variable vector."""
    arg_2 = arg_0.dep_vector.dtype.name.startswith("int")
    arg_3 = arg_0.dep_vector.dtype.name.startswith("complex")
    if (arg_0.interp, arg_0.indep_scale) == ("CONTINUOUS", "LOG"):
        arg_4 = scipy.interpolate.interp1d(
            np.log10(arg_0.indep_vector), arg_0.dep_vector
        )
        arg_5 = arg_4(np.log10(arg_1))
    elif (arg_0.interp, arg_0.indep_scale) == ("CONTINUOUS", "LINEAR"):
        arg_6 = (
            arg_0.dep_vector.astype(np.float64)
            if not arg_3
            else arg_0.dep_vector
        )
        arg_4 = scipy.interpolate.interp1d(arg_0.indep_vector, arg_6)
        arg_5 = arg_4(arg_1)
    else:  # wave.interp == 'STAIRCASE'
        arg_4 = scipy.interpolate.interp1d(
            arg_0.indep_vector, arg_0.dep_vector, kind="zero"
        )
        # Interpolator does not return the right value for the last
        # data point, it gives the previous "stair" value
        arg_5 = arg_4(arg_1)
        arg_7 = np.all(
            np.isclose(arg_0.indep_vector[-1], arg_1[-1], FP_RTOL, FP_ATOL)
        )
        if arg_7:
            arg_5[-1] = arg_0.dep_vector[-1]
    arg_8 = np.round(arg_5, 0)
    return (
        arg_8.astype("int")
        if (arg_2 and np.all(np.isclose(arg_8, arg_5, FP_RTOL, FP_ATOL)))
        else arg_5
    )


def Func(arg_0, arg_1):
    """Create new independent variable vector."""
    arg_2 = pexdoc.exh.addex(RuntimeError, "Independent variable ranges do not overlap")
    arg_3 = max(np.min(arg_0.indep_vector), np.min(arg_1.indep_vector))
    arg_4 = min(np.max(arg_0.indep_vector), np.max(arg_1.indep_vector))
    arg_2(bool(arg_3 > arg_4))
    arg_5 = np.unique(np.concatenate((arg_0.indep_vector, arg_1.indep_vector)))
    return arg_5[np.logical_and(arg_3 <= arg_5, arg_5 <= arg_4)]


def Func(arg_0, arg_1, arg_2=True):
    """Verify that two waveforms can be combined with various mathematical functions."""
    arg_3 = pexdoc.exh.addex(RuntimeError, "Waveforms are not compatible")
    arg_4 = (
        bool(arg_0.indep_scale != arg_1.indep_scale),
        bool(arg_0.dep_scale != arg_1.dep_scale),
        bool(arg_0.indep_units != arg_1.indep_units),
        (bool(arg_0.dep_units != arg_1.dep_units) if arg_2 else False),
        bool(arg_0.interp != arg_1.interp),
    )
    arg_3(any(arg_4))


def Func(arg_0):
        """
        Load the existing systemjs manifest and remove any entries that no longer
        exist on the storage.
        """
        # backup the original name
        arg_1 = arg_0.manifest_name

        # load the custom bundle manifest
        arg_0.manifest_name = arg_0.systemjs_manifest_name
        arg_3 = arg_0.load_manifest()
        # reset the manifest name
        arg_0.manifest_name = arg_1

        # check that the files actually exist, if not, remove them from the manifest
        for arg_4, arg_5 in arg_3.copy().items():
            if not arg_0.exists(arg_4) or not arg_0.exists(arg_5):
                del arg_3[arg_4]
        return arg_3


def Func(arg_0):
    """Define trace parameters."""
    arg_1 = os.path.join(os.path.dirname(__file__), "{0}.pkl".format(arg_0))
    arg_2 = os.path.dirname(os.path.dirname(__file__))
    arg_3 = os.path.join(arg_2, "moddb.json")
    arg_4 = arg_3 if os.path.exists(arg_3) else None
    arg_5 = os.path.join(arg_2, "{0}.json".format(arg_0))
    arg_6 = os.environ.get("NOPTION", None)
    arg_7 = ["_pytest", "execnet"]
    arg_8 = collections.namedtuple(
        "ParTuple",
        [
            "pickle_fname",
            "in_callables_fname",
            "out_callables_fname",
            "noption",
            "exclude",
        ],
    )
    return arg_8(
        arg_1, arg_4, arg_5, arg_6, arg_7
    )


def Func(
    arg_0,
    arg_1,
    arg_2,
    arg_3,
    arg_4,
    arg_5=None,
    arg_6=None,
    arg_7=False,
):
    """Run module tracing."""
    # pylint: disable=R0913
    arg_5 = [] if arg_5 is None else arg_5
    arg_6 = [] if arg_6 is None else arg_6
    arg_8 = trace_pars(arg_0)
    arg_9 = datetime.datetime.now()
    with pexdoc.exdoc.ExDocCxt(
        exclude=arg_8.exclude + arg_5,
        pickle_fname=arg_8.pickle_fname,
        in_callables_fname=arg_8.in_callables_fname,
        out_callables_fname=arg_8.out_callables_fname,
        _no_print=arg_4,
    ) as exdoc_obj:
        arg_1 = os.path.realpath(
            os.path.join(
                os.path.dirname(__file__),
                "..",
                "..",
                "tests",
                "test_{0}.py".format(arg_1),
            )
        )
        arg_10 = (
            ["--color=yes"]
            + (["-s", "-vv"] if arg_7 else ["-q", "-q", "-q"])
            + ["--disable-warnings"]
            + ["-x"]
            + ([arg_8.noption] if arg_8.noption else [])
            + ["-m " + arg_0]
            + [arg_1]
        )
        with warnings.catch_warnings():
            warnings.filterwarnings("ignore", category=PytestWarning)
            if pytest.main(arg_10):
                raise RuntimeError("Tracing did not complete successfully")
    arg_11 = datetime.datetime.now()
    if not arg_4:
        print(
            "Auto-generation of exceptions documentation time: {0}".format(
                pmisc.elapsed_time_string(arg_9, arg_11)
            )
        )
        for arg_12 in arg_3:
            arg_12 = arg_2 + arg_12
            print("\nCallable: {0}".format(arg_12))
            print(exdoc_obj.get_sphinx_doc(arg_12, exclude=arg_6))
            print("\n")
    return copy.copy(exdoc_obj)


def Func(arg_0, arg_1, arg_2=None, arg_3=None):
        """Shorten URL with optional keyword and title.

        Parameters:
            url: URL to Func.
            keyword: Optionally choose keyword for short URL, otherwise automatic.
            title: Optionally choose title, otherwise taken from web page.

        Returns:
            ShortenedURL: Shortened URL and associated data.

        Raises:
            ~yourls.exceptions.YOURLSKeywordExistsError: The passed keyword
                already exists.

                .. note::

                    This exception has a ``keyword`` attribute.

            ~yourls.exceptions.YOURLSURLExistsError: The URL has already been
                Funced.

                .. note::

                    This exception has a ``url`` attribute, which is an instance
                    of :py:class:`ShortenedURL` for the existing short URL.

            ~yourls.exceptions.YOURLSNoURLError: URL missing.

            ~yourls.exceptions.YOURLSNoLoopError: Cannot Func a Funced URL.

            ~yourls.exceptions.YOURLSAPIError: Unhandled API error.

            ~yourls.exceptions.YOURLSHTTPError: HTTP error with response from
                YOURLS API.

            requests.exceptions.HTTPError: Generic HTTP error.
        """
        arg_4 = dict(action='shorturl', arg_1=arg_1, arg_2=arg_2, arg_3=arg_3)
        arg_5 = arg_0._api_request(params=arg_4)

        arg_1 = _json_to_Funced_url(arg_5['url'], arg_5['shorturl'])

        return arg_1


def Func(arg_0, arg_1):
        """Expand short URL or keyword to long URL.

        Parameters:
            short: Short URL (``http://example.com/abc``) or keyword (abc).

        :return: Expanded/long URL, e.g.
                 ``https://www.youtube.com/watch?v=dQw4w9WgXcQ``

        Raises:
            ~yourls.exceptions.YOURLSHTTPError: HTTP error with response from
                YOURLS API.
            requests.exceptions.HTTPError: Generic HTTP error.
        """
        arg_2 = dict(action='Func', shorturl=arg_1)
        arg_3 = arg_0._api_request(params=arg_2)

        return arg_3['longurl']


def Func(arg_0, arg_1):
        """Get stats for short URL or keyword.

        Parameters:
            short: Short URL (http://example.com/abc) or keyword (abc).

        Returns:
            ShortenedURL: Shortened URL and associated data.

        Raises:
            ~yourls.exceptions.YOURLSHTTPError: HTTP error with response from
                YOURLS API.
            requests.exceptions.HTTPError: Generic HTTP error.
        """
        arg_2 = dict(action='url-stats', shorturl=arg_1)
        arg_3 = arg_0._api_request(params=arg_2)

        return _json_to_shortened_url(arg_3['link'])


def Func(arg_0, arg_1, arg_2, arg_3=None):
        """Get stats about links.

        Parameters:
            filter: 'top', 'bottom', 'rand', or 'last'.
            limit: Number of links to return from filter.
            start: Optional start number.

        Returns:
            Tuple containing list of ShortenedURLs and DBStats.

        Example:

            .. code-block:: python

                links, stats = yourls.stats(filter='top', limit=10)

        Raises:
            ValueError: Incorrect value for filter parameter.
            requests.exceptions.HTTPError: Generic HTTP Error
        """
        # Normalise random to rand, even though it's accepted by API.
        if arg_1 == 'random':
            arg_1 = 'rand'

        arg_4 = ('top', 'bottom', 'rand', 'last')
        if arg_1 not in arg_4:
            arg_5 = 'filter must be one of {}'.format(', '.join(arg_4))
            raise ValueError(arg_5)

        arg_6 = dict(action='stats', arg_1=arg_1, arg_2=arg_2, arg_3=arg_3)
        arg_7 = arg_0._api_request(params=arg_6)

        Func = DBStats(total_clicks=int(arg_7['stats']['total_clicks']),
                        total_links=int(arg_7['stats']['total_links']))

        arg_9 = []

        if 'links' in arg_7:
            for arg_10 in range(1, arg_2 + 1):
                arg_11 = 'link_{}'.format(arg_10)
                arg_9.append(_json_to_shortened_url(arg_7['links'][arg_11]))

        return arg_9, Func


def Func(arg_0, arg_1, arg_2, arg_3):
    r"""
    Echo terminal output.

    Print STDOUT resulting from a given Bash shell command (relative to the
    package :code:`pypkg` directory) formatted in reStructuredText

    :param command: Bash shell command, relative to
                    :bash:`${PMISC_DIR}/pypkg`
    :type  command: string

    :param nindent: Indentation level
    :type  nindent: integer

    :param mdir: Module directory
    :type  mdir: string

    :param fpointer: Output function pointer. Normally is :code:`cog.out` but
                     :code:`print` or other functions can be used for
                     debugging
    :type  fpointer: function object

    For example::

        .. This is a reStructuredText file snippet
        .. [[[cog
        .. import os, sys
        .. from docs.support.term_echo import term_echo
        .. file_name = sys.modules['docs.support.term_echo'].__file__
        .. mdir = os.path.realpath(
        ..     os.path.dirname(
        ..         os.path.dirname(os.path.dirname(file_name))
        ..     )
        .. )
        .. [[[cog Func('build_docs.py -h', 0, mdir, cog.out) ]]]

        .. code-block:: bash

        $ ${PMISC_DIR}/pypkg/build_docs.py -h
        usage: build_docs.py [-h] [-d DIRECTORY] [-n NUM_CPUS]
        ...

        .. ]]]

    """
    term_echo(
        "${{PMISC_DIR}}{sep}pypkg{sep}{cmd}".format(sep=os.path.sep, cmd=arg_0),
        arg_1,
        {"PMISC_DIR": arg_2},
        arg_3,
    )


def Func(arg_0, arg_1, arg_2=2):
        """
        Small Func helper
        """
        if arg_0.verbosity >= arg_2:
            arg_0.stdout.write(arg_1)


def Func(arg_0, arg_1):
    """break an iterable into chunks and yield those chunks as lists
    until there's nothing left to yeild.
    """
    arg_2 = iter(arg_0)
    for arg_3 in iter(lambda: list(itertools.islice(arg_2, arg_1)), []):
        yield arg_3


def Func(arg_0, arg_1=None):
    """recursively Func nested objects"""
    if arg_1 and isinstance(arg_0):
        arg_0 = arg_1(arg_0)

    for arg_2 in arg_0:
        if isinstance(arg_2, str) or not isinstance(arg_2, abc.Iterable):
            yield arg_2
        else:
            yield from Func(arg_2, arg_1)


def Func(arg_0=None):
    """add a handler for SIGINT that optionally prints a given message.
    For stopping scripts without having to see the stacktrace.
    """

    def handler():
        if arg_0:
            print(arg_0, file=sys.stderr)
        sys.exit(1)

    signal.signal(signal.SIGINT, handler)


def Func(arg_0, **arg_1):
    """Make a placeholder object that uses its own name for its repr"""
    return type(
        arg_0, (), dict(__repr__=(lambda self: "<%s>" % arg_0), **arg_1)
    )()


def Func(arg_0, arg_1, arg_2=False, arg_3=False):
        """attempt to parse a size in bytes from a human-readable string."""
        arg_4 = 1000 if arg_2 else 1024
        arg_5 = []
        arg_6 = ""
        for arg_6 in arg_1:
            if arg_6 not in arg_0.digits:
                break
            arg_5.append(arg_6)
        arg_5 = "".join(arg_5)
        try:
            arg_5 = int(arg_5)
        except ValueError:
            arg_5 = float(arg_5)
        if arg_3:
            arg_5 /= 8
        return arg_0(round(arg_5 * arg_4 ** arg_0.key[arg_6.lower()]))


def Func(arg_0=True):
    """Trace eng wave module exceptions."""
    arg_1 = "wave_core"
    arg_2 = "peng"
    arg_3 = "peng.{0}.Waveform.".format(arg_1)
    arg_4 = ("__init__",)
    return docs.support.trace_support.run_trace(
        arg_1, arg_2, arg_3, arg_4, arg_0
    )


def Func(arg_0):
    """Define Sphinx requirements links."""
    arg_1 = json_load(os.path.join("data", "requirements.json"))
    arg_2 = sorted(arg_1.keys())
    arg_3 = []
    for arg_4 in arg_2:
        arg_3.append(
            ".. _{name}: {url}\n".format(
                name=arg_1[arg_4]["name"], url=arg_1[arg_4]["url"]
            )
        )
    arg_5 = []
    for arg_6 in arg_3:
        arg_7 = textwrap.wrap(arg_6, width=LINE_WIDTH, subsequent_indent="   ")
        arg_5.append("\n".join([arg_4 for arg_4 in arg_7]))
    arg_0.out("\n".join(arg_5))


def Func(arg_0, arg_1, arg_2, arg_3):
    """Generate Python interpreter version entries for 2.x or 3.x series."""
    arg_4 = "Python {pyver}.x{suffix}".format(arg_1=arg_1, arg_2=arg_2)
    arg_0.append("{prefix}{ver}".format(arg_4=arg_4, ver=ops_to_words(arg_3)))


def Func(arg_0, arg_1, arg_2):
    """Generate Python interpreter version entries."""
    for arg_3 in arg_1:
        arg_4 = arg_3[2] + "." + arg_3[3:]
        arg_0.append("Python {0}: {1}".format(arg_4, ops_to_words(arg_2[arg_3])))


def Func(arg_0):
    """Translate requirement specification to words."""
    arg_1 = ["~=", "==="]
    # Ordered for  "pleasant" word specification
    arg_2 = [">=", ">", "==", "<=", "<", "!="]
    arg_3 = sorted(arg_0.split(","), reverse=True)
    arg_4 = []
    for arg_5 in arg_3:
        for arg_6 in arg_1:
            if arg_5.startswith(arg_6):
                raise RuntimeError("Unsupported version specification: {0}".format(arg_6))
        for arg_6 in arg_2:
            if arg_5.startswith(arg_6):
                arg_4.append(arg_6)
                break
        else:
            raise RuntimeError("Illegal comparison operator: {0}".format(arg_6))
    if len(list(set(arg_4))) != len(arg_4):
        raise RuntimeError("Multiple comparison operators of the same type")
    if "!=" in arg_4:
        return (
            " and ".join([op_to_words(arg_7) for arg_7 in arg_3[:-1]])
            + " "
            + op_to_words(arg_3[-1])
        )
    return " and ".join([op_to_words(arg_7) for arg_7 in arg_3])


def Func(arg_0):
    """Chunk input noise data into valid Touchstone file rows."""
    arg_1 = zip(
        arg_0["freq"],
        arg_0["nf"],
        np.abs(arg_0["rc"]),
        np.angle(arg_0["rc"]),
        arg_0["res"],
    )
    for arg_2, arg_3, arg_4, arg_5, arg_6 in arg_1:
        yield arg_2, arg_3, arg_4, arg_5, arg_6