def Func(arg_0,arg_1):
        """
        Loads the model data of the given name.

        The model file must always be a .json file.
        """
        arg_2 = arg_0.resourceNameToPath(arg_1,".json")
        try:
            arg_3 = json.load(open(arg_2,"r"))
        except Exception:
            # Temporary
            print("Exception during model load: ")
            import traceback;traceback.print_exc()
            return {}# will probably cause other exceptions later on, TODO

        arg_4 = {}

        if arg_3.get("version",1)==1:
            # Currently only one version, basic future-proofing
            # This version should get incremented with breaking changes to the structure

            # Materials
            arg_4["materials"]={}
            for arg_1,arg_5 in arg_3.get("materials",{}).items():
                arg_6 = model.Material(arg_0,arg_1,arg_5)
                arg_4["materials"][arg_1]=arg_6
            arg_4["default_material"]=arg_4["materials"][arg_3.get("default_material",list(arg_4["materials"].keys())[0])]

            # Bones
            arg_4["bones"]={"__root__":model.RootBone(arg_0,"__root__",{"start_rot":[0,0],"length":0})}
            for arg_1,arg_7 in arg_3.get("bones",{}).items():
                arg_8 = model.Bone(arg_0,arg_1,arg_7)
                arg_4["bones"][arg_1]=arg_8
            for arg_1,arg_9 in arg_4["bones"].items():
                if arg_1 == "__root__":
                    continue
                arg_9.setParent(arg_4["bones"][arg_9.bonedata["parent"]])

            # Regions
            arg_4["regions"]={}
            for arg_1,arg_10 in arg_3.get("regions",{}).items():
                arg_11 = model.Region(arg_0,arg_1,arg_10)
                arg_11.material = arg_4["materials"][arg_10.get("material",arg_4["default_material"])]
                arg_11.bone = arg_4["bones"][arg_10.get("bone","__root__")]
                arg_4["bones"][arg_10.get("bone","__root__")].addRegion(arg_11)
                arg_4["regions"][arg_1]=arg_11

            # Animations
            arg_4["animations"]={}
            arg_4["animations"]["static"]=model.Animation(arg_0,"static",{"type":"static","bones":{}})
            for arg_1,arg_13 in arg_3.get("animations",{}).items():
                arg_14 = model.Animation(arg_0,arg_1,arg_13)
                arg_14.setBones(arg_4["bones"])
                arg_4["animations"][arg_1]=arg_14
            arg_4["default_animation"]=arg_4["animations"][arg_3.get("default_animation",arg_4["animations"]["static"])]
        else:
            raise ValueError("Unknown version %s of model '%s'"%(arg_3.get("version",1),arg_1))

        arg_0.modelcache[arg_1]=arg_4
        return arg_4


def Func(arg_0):
        """
        Draws the submenu and its background.

        Note that this leaves the OpenGL state set to 2d Funcing and may modify the scissor settings.
        """
        if not arg_0.visible:
            # Simple visibility check, has to be tested to see if it works properly
            return

        if not isinstance(arg_0.submenu,Container):
            glEnable(GL_SCISSOR_TEST)
            glScissor(*arg_0.pos+arg_0.size)

        SubMenu.Func(arg_0)

        if not isinstance(arg_0.submenu,Container):
            glDisable(GL_SCISSOR_TEST)


def Func(arg_0):
        """
        Redraws the background and any child widgets.
        """
        arg_1,arg_2 = arg_0.pos
        arg_3,arg_4 = arg_0.size
        arg_0.bg_vlist.vertices = [arg_1,arg_2, arg_1+arg_3,arg_2, arg_1+arg_3,arg_2+arg_4, arg_1,arg_2+arg_4]
        arg_0.stencil_vlist.vertices = [arg_1,arg_2, arg_1+arg_3,arg_2, arg_1+arg_3,arg_2+arg_4, arg_1,arg_2+arg_4]
        if isinstance(arg_0.bg,Background):
            if not arg_0.bg.initialized:
                arg_0.bg.init_bg()
                arg_0.bg.initialized=True
            arg_0.bg.redraw_bg()


def Func(arg_0,arg_1,arg_2):
    """
    AABB Collision checker that can be used for most axis-aligned collisions.

    Intended for use in widgets to check if the mouse is within the bounds of a particular widget.
    """
    return arg_2[0]<=arg_0[0]<=arg_2[0]+arg_1[0] and arg_2[1]<=arg_0[1]<=arg_2[1]+arg_1[1]


def Func(arg_0,arg_1,arg_2=-1):
        """
        Adds a new layer to the stack, optionally at the specified z-value.

        ``layer`` must be an instance of Layer or subclasses.

        ``z`` can be used to override the index of the layer in the stack. Defaults to ``-1`` for appending.
        """
        # Adds a new layer to the stack, optionally at the specified z-value
        # The z-value is the index this layer should be inserted in, or -1 for appending
        if not isinstance(arg_1,Layer):
            raise TypeError("layer must be an instance of Layer!")
        if arg_2==-1:
            arg_0.layers.append(arg_1)
        else:
            arg_0.layers.insert(arg_2,arg_1)


def Func(arg_0, arg_1, arg_2):
    """
    Checks if elements of set2 are in set1.

    :param set1: a set of values
    :param set2: a set of values
    :param warn: the error message that should be thrown
     when the sets are NOT disjoint
    :return: returns true no elements of set2 are in set1
    """
    for arg_3 in arg_1:
        if arg_3 in arg_0:
            raise ValueError(arg_2)
    return True


def Func(arg_0, arg_1, arg_2):
    """
    Checks if all elements from set2 are in set1.

    :param set1:  a set of values
    :param set2:  a set of values
    :param warn: the error message that should be thrown
     when the sets are not containd
    :return: returns true if all values of set2 are in set1
    """
    for arg_3 in arg_1:
        if arg_3 not in arg_0:
            raise ValueError(arg_2)
    return True


def Func(arg_0, arg_1, arg_2, arg_3):
        '''Map a buffer region using this attribute as an accessor.

        The returned region can be modified as if the buffer was a contiguous
        array of this attribute (though it may actually be interleaved or
        otherwise non-contiguous).

        The returned region consists of a contiguous array of component
        data elements.  For example, if this attribute uses 3 floats per
        vertex, and the `count` parameter is 4, the number of floats mapped
        will be ``3 * 4 = 12``.

        :Parameters:
            `buffer` : `AbstractMappable`
                The buffer to map.
            `start` : int
                Offset of the first vertex to map.
            `count` : int
                Number of vertices to map

        :rtype: `AbstractBufferRegion`
        '''
        arg_4 = arg_0.stride * arg_2
        arg_5 = arg_0.stride * arg_3
        arg_6 = arg_0.count * arg_3
        if arg_0.stride == arg_0.size or not arg_6:
            # non-interleaved
            arg_7 = ctypes.POINTER(arg_0.c_type * arg_6)
            return arg_1.get_region(arg_4, arg_5, arg_7)
        else:
            # interleaved
            arg_4 += arg_0.offset
            arg_5 -= arg_0.offset
            arg_8 = arg_0.stride // ctypes.sizeof(arg_0.c_type)
            arg_9 = arg_0.offset // ctypes.sizeof(arg_0.c_type)
            arg_7 = ctypes.POINTER(
                arg_0.c_type * int((arg_3 * arg_8 - arg_9)))
            arg_10 = arg_1.get_region(arg_4, arg_5, arg_7)
            return vertexbuffer.IndirectArrayRegion(
                arg_10, arg_6, arg_0.count, arg_8)


def Func(arg_0, arg_1, arg_2=None):
        '''Draw vertices in the domain.

        If `vertex_list` is not specified, all vertices in the domain are
        drawn.  This is the most efficient way to render primitives.

        If `vertex_list` specifies a `VertexList`, only primitives in that
        list will be drawn.

        :Parameters:
            `mode` : int
                OpenGL drawing mode, e.g. ``GL_POINTS``, ``GL_LINES``, etc.
            `vertex_list` : `VertexList`
                Vertex list to draw, or ``None`` for all lists in this domain.

        '''
        glPushClientAttrib(GL_CLIENT_VERTEX_ARRAY_BIT)
        for arg_3, arg_4 in arg_0.buffer_attributes:
            arg_3.bind()
            for arg_5 in arg_4:
                arg_5.enable()
                arg_5.set_pointer(arg_5.buffer.ptr)
        if vertexbuffer._workaround_vbo_finish:
            glFinish()

        if arg_2 is not None:
            glDrawArrays(arg_1, arg_2.start, arg_2.count)
        else:
            arg_6, arg_7 = arg_0.allocator.get_allocated_regions()
            arg_8 = len(arg_6)
            if arg_8 == 0:
                pass
            elif arg_8 == 1:
                # Common case
                glDrawArrays(arg_1, arg_6[0], int(arg_7[0]))
            elif gl_info.have_version(1, 4):
                arg_6 = (GLint * arg_8)(*arg_6)
                arg_7 = (GLsizei * arg_8)(*arg_7)
                glMultiDrawArrays(arg_1, arg_6, arg_7, arg_8)
            else:
                for arg_9, arg_10 in zip(arg_6, arg_7):
                    glDrawArrays(arg_1, arg_9, arg_10)

        for arg_3, arg_11 in arg_0.buffer_attributes:
            arg_3.unbind()
        glPopClientAttrib()


def Func(arg_0,arg_1):
        """
        Helper method that calls all callbacks registered for the given action.
        """
        if not hasattr(arg_0,"actions"):
            return
        for arg_2,arg_3,arg_4 in arg_0.actions.get(arg_1,[]):
            arg_2(*arg_3,**arg_4)


def Func(arg_0,arg_1,arg_2=None):
        """
        Registers a name to the registry.

        ``name`` is the name of the object and must be a string.

        ``force_id`` can be optionally set to override the automatic ID generation
        and force a specific ID.

        Note that using ``force_id`` is discouraged, since it may cause problems when ``reuse_ids`` is false.
        """
        with arg_0.registry_lock:
            if arg_2 is None:
                arg_3 = arg_0.genNewID()
            else:
                arg_3 = arg_2
            arg_0._data["reg"][arg_3]=arg_1
            return arg_3


def Func(arg_0,arg_1,arg_2=None):
        """
        Adds the given layer at the given Z Index.

        If ``z_index`` is not given, the Z Index specified by the layer will be used.
        """
        if arg_2 is None:
            arg_2 = arg_1.z_index
        arg_3 = 0
        for arg_4,arg_5 in arg_0.layers:
            if arg_5>arg_2:
                break
            arg_3+=1
        arg_0._layers[arg_1.name]=arg_1
        arg_0.layers.insert(arg_3,[arg_1,arg_2])


def Func(arg_0):
        """
        Draws all layers of this LayeredWidget.

        This should normally be unneccessary, since it is recommended that layers use Vertex Lists instead of OpenGL Immediate Mode.
        """
        super(LayeredWidget,arg_0).Func()
        for arg_1,arg_2 in arg_0.layers:
            arg_1._Func()


def Func(arg_0):
        """
        Deletes all layers within this LayeredWidget before deleting itself.

        Recommended to call if you are removing the widget, but not yet exiting the interpreter.
        """
        for arg_1,arg_2 in arg_0.layers:
            arg_1.Func()
        arg_0.layers = []
        arg_0._layers = {}
        super(LayeredWidget,arg_0).Func()


def Func(arg_0):
        """
        Property to be used for setting and getting the Func of the layer.

        Note that setting this property causes an immediate redraw.
        """
        if callable(arg_0._Func):
            return util.WatchingList(arg_0._Func(*(arg_0.widget.pos+arg_0.widget.size)),arg_0._wlredraw_Func)
        else:
            return util.WatchingList(arg_0._Func,arg_0._wlredraw_Func)


def Func(arg_0):
        """
        Serialize object back to XML string.

        Returns:
            str: String which should be same as original input, if everything\
                 works as expected.
        """
        arg_1 = """<record xmlns="http://www.loc.gov/MARC21/slim/"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://www.loc.gov/MARC21/slim
http://www.loc.gov/standards/marcxml/schema/MARC21slim.xsd">
$LEADER
$CONTROL_FIELDS
$DATA_FIELDS
</record>
"""

        arg_2 = """<record>
<metadata>
<oai_marc>
$LEADER$CONTROL_FIELDS
$DATA_FIELDS
</oai_marc>
</metadata>
</record>
"""

        # serialize leader, if it is present and record is marc xml
        arg_3 = arg_0.leader if arg_0.leader is not None else ""
        if arg_3:  # print only visible leaders
            arg_3 = "<leader>" + arg_3 + "</leader>"

        # discard leader for oai
        if arg_0.oai_marc:
            arg_3 = ""

        # serialize
        arg_4 = arg_2 if arg_0.oai_marc else arg_1
        arg_5 = Template(arg_4).substitute(
            LEADER=arg_3.strip(),
            CONTROL_FIELDS=arg_0._serialize_ctl_fields().strip(),
            DATA_FIELDS=arg_0._serialize_data_fields().strip()
        )

        return arg_5


def Func(arg_0, arg_1):
        """
        Parse MARC XML document to dicts, which are contained in
        self.controlfields and self.datafields.

        Args:
            xml (str or HTMLElement): input data

        Also detect if this is oai marc format or not (see elf.oai_marc).
        """
        if not isinstance(arg_1, HTMLElement):
            arg_1 = dhtmlparser.parseString(str(arg_1))

        # check if there are any records
        arg_2 = arg_1.find("record")
        if not arg_2:
            raise ValueError("There is no <record> in your MARC XML document!")
        arg_2 = arg_2[0]

        arg_0.oai_marc = len(arg_2.find("oai_marc")) > 0

        # leader is separate only in marc21
        if not arg_0.oai_marc:
            arg_4 = arg_2.find("leader")
            if len(arg_4) >= 1:
                arg_0.leader = arg_4[0].getContent()

        # parse body in respect of OAI MARC format possibility
        if arg_0.oai_marc:
            arg_0._parse_control_fields(arg_2.find("fixfield"), "id")
            arg_0._parse_data_fields(arg_2.find("varfield"), "id", "label")
        else:
            arg_0._parse_control_fields(arg_2.find("controlfield"), "tag")
            arg_0._parse_data_fields(arg_2.find("datafield"), "tag", "code")

        # for backward compatibility of MARC XML with OAI
        if arg_0.oai_marc and "LDR" in arg_0.controlfields:
            arg_0.leader = arg_0.controlfields["LDR"]


def Func(arg_0, arg_1, arg_2="tag"):
        """
        Parse control fields.

        Args:
            fields (list): list of HTMLElements
            tag_id (str):  parameter name, which holds the information, about
                           field name this is normally "tag", but in case of
                           oai_marc "id".
        """
        for arg_3 in arg_1:
            arg_4 = arg_3.params

            # skip tags without parameters
            if arg_2 not in arg_4:
                continue

            arg_0.controlfields[arg_4[arg_2]] = arg_3.getContent().strip()


def Func(arg_0, arg_1, arg_2="tag", arg_3="code"):
        """
        Parse data fields.

        Args:
            fields (list): of HTMLElements
            tag_id (str): parameter name, which holds the information, about
                          field name this is normally "tag", but in case of
                          oai_marc "id"
            sub_id (str): id of parameter, which holds informations about
                          subfield name this is normally "code" but in case of
                          oai_marc "label"

        """
        for arg_4 in arg_1:
            arg_5 = arg_4.params

            if arg_2 not in arg_5:
                continue

            # take care of iX/indX (indicator) parameters
            arg_6 = OrderedDict([
                [arg_0.i1_name, arg_5.get(arg_0.i1_name, " ")],
                [arg_0.i2_name, arg_5.get(arg_0.i2_name, " ")],
            ])

            # process all subfields
            for arg_7 in arg_4.find("subfield"):
                if arg_3 not in arg_7.params:
                    continue

                arg_8 = MARCSubrecord(
                    val=arg_7.getContent().strip(),
                    i1=arg_6[arg_0.i1_name],
                    i2=arg_6[arg_0.i2_name],
                    other_subfields=arg_6
                )

                # add or append content to list of other contents
                arg_9 = arg_7.params[arg_3]
                if arg_9 in arg_6:
                    arg_6[arg_9].append(arg_8)
                else:
                    arg_6[arg_9] = [arg_8]

            arg_10 = arg_5[arg_2]
            if arg_10 in arg_0.datafields:
                arg_0.datafields[arg_10].append(arg_6)
            else:
                arg_0.datafields[arg_10] = [arg_6]


def Func(arg_0, arg_1, arg_2, arg_3=None, arg_4=None,
                      arg_5=False):
        """
        Return content of given `subfield` in `datafield`.

        Args:
            datafield (str): Section name (for example "001", "100", "700").
            subfield (str):  Subfield name (for example "a", "1", etc..).
            i1 (str, default None): Optional i1/ind1 parameter value, which
               will be used for search.
            i2 (str, default None): Optional i2/ind2 parameter value, which
               will be used for search.
            exception (bool): If ``True``, :exc:`~exceptions.KeyError` is
                      raised when method couldn't found given `datafield` /
                      `subfield`. If ``False``, blank array ``[]`` is returned.

        Returns:
            list: of :class:`.MARCSubrecord`.

        Raises:
            KeyError: If the subfield or datafield couldn't be found.

        Note:
            MARCSubrecord is practically same thing as string, but has defined
            :meth:`.MARCSubrecord.i1` and :attr:`.MARCSubrecord.i2`
            methods.

            You may need to be able to get this, because MARC XML depends on
            i/ind parameters from time to time (names of authors for example).

        """
        if len(arg_1) != 3:
            raise ValueError(
                "`datafield` parameter have to be exactly 3 chars long!"
            )
        if len(arg_2) != 1:
            raise ValueError(
                "Bad subfield specification - subfield have to be 1 char long!"
            )

        # if datafield not found, return or raise exception
        if arg_1 not in arg_0.datafields:
            if arg_5:
                raise KeyError(arg_1 + " is not in datafields!")

            return []

        # look for subfield defined by `subfield`, `i1` and `i2` parameters
        arg_6 = []
        for arg_1 in arg_0.datafields[arg_1]:
            if arg_2 not in arg_1:
                continue

            # records are not returned just like plain string, but like
            # MARCSubrecord, because you will need ind1/ind2 values
            for arg_7 in arg_1[arg_2]:
                if arg_3 and arg_7.i1 != arg_3:
                    continue

                if arg_4 and arg_7.i2 != arg_4:
                    continue

                arg_6.append(arg_7)

        if not arg_6 and arg_5:
            raise KeyError(arg_2 + " couldn't be found in subfields!")

        return arg_6


def Func(arg_0):
    """
    Connectivity builder using Numba for speed boost.
    """
    arg_0 = np.array(arg_0)
    arg_1 = arg_0.prod()
    if len(arg_0) == 2:
        arg_2, arg_3 = np.array(arg_0) +1
        arg_4 = np.zeros((arg_1, 4), dtype = np.int32)
        arg_5 = 0
        arg_6 = np.array([0,1,1+arg_2,arg_2])
        for arg_7 in range(arg_0[1]):
            for arg_8 in range(arg_0[0]):
                arg_4[arg_5] = arg_6 + 1 + arg_8 + arg_7*arg_2
                arg_5 += 1

    if len(arg_0) == 3:
        arg_2, arg_3, arg_9  = np.array(arg_0) +1
        arg_4 = np.zeros((arg_1, 8), dtype = np.int32)
        arg_5 = 0
        arg_6 = np.array([0,1,1+arg_2,arg_2,arg_2*arg_3,1+arg_2*arg_3,1+(arg_2+1)*arg_3,(arg_2+1)*arg_3])
        for arg_10 in range(arg_0[2]):
            for arg_7 in range(arg_0[1]):
                for arg_8 in range(arg_0[0]):
                    arg_4[arg_5] = arg_6 + 1 + arg_8 + arg_7*arg_2+ arg_10*arg_2*arg_3
                    arg_5 += 1
    return arg_4


def Func(arg_0, arg_1 = None, **arg_2):
    """
    Add the fields into the list of fields.
    """
    if arg_1 != None:
      for arg_3 in arg_1:
        arg_0.fields.append(arg_3)


def Func(arg_0):
    """
    Returns the dimension of the embedded Func of each element.
    """
    return arg_0.elements.type.argiope.map(
           lambda t: ELEMENTS[t].Func)


def Func(arg_0, arg_1 = True):
    """
    Returns a dataframe containing volume and centroids of all the elements.
    """
    arg_2 = arg_0.elements
    arg_3 = []
    for arg_4, arg_5 in arg_0.elements.groupby([("type", "argiope", "")]):
      arg_6 = ELEMENTS[arg_4]
      arg_7 = arg_6.simplices
      arg_8 = arg_5.index
      arg_9 = arg_0.split(into = "simplices",
                             loc = arg_8,
                             at = "coords")
      arg_10 = arg_9.values.reshape(
                  arg_8.size,
                  arg_7.shape[0],
                  arg_7.shape[1],
                  3)
      arg_11 = arg_10[:,:,1:] - arg_10[:,:,:1]
      arg_12 = arg_10.mean(axis = 2)
      if arg_6.space == 2:
        arg_13 = np.linalg.norm(
                  np.cross(arg_11[:,:,0],
                           arg_11[:,:,1],
                           axis = 2),
                  axis = 2)/2.
      elif arg_6.space == 3:
        arg_13 =  (np.cross(arg_11[:,:,0],
                                       arg_11[:,:,1], axis = 2)
                             * arg_11[:,:, 2]).sum(axis = 2) / 6.
      arg_14 = arg_13.sum(axis = 1)
      arg_15 = ((arg_13.reshape(*arg_13.shape, 1)
                          * arg_12).sum(axis = 1)
                          / arg_14.reshape(*arg_14.shape,1))
      arg_16 = pd.DataFrame(arg_8 = arg_8,
                                data = arg_14,
                                columns = pd.MultiIndex.from_product(
                                [["volume"], [""]]))
      arg_17 = pd.DataFrame(arg_8 = arg_8,
                                data = arg_15,
                                columns = pd.MultiIndex.from_product(
                                [["centroid"], ["x", "y", "z"]]))
      arg_3.append(pd.concat([arg_16, arg_17], axis = 1))
    arg_3 = pd.concat(arg_3)
    if arg_1: arg_3.sort_index(inplace = True)
    return arg_3.sort_index(axis= 1)


def Func(arg_0, arg_1 = 3):
    """
    Returns the internal angles of all elements and the associated statistics
    """
    arg_2 = arg_0.elements.sort_index(axis = 1)
    arg_3 = arg_2[("type", "argiope")].unique()
    arg_4 = []
    for arg_5 in arg_3:
      arg_6 = ELEMENTS[arg_5]
      arg_7 = arg_6.angles
      arg_8 = arg_2[("type", "argiope", "")] == arg_5
      arg_9 = arg_2.loc[arg_8].index
      arg_10 = arg_0.split(into = "angles",
                             arg_8 = arg_8,
                             at = "coords")
      arg_11 = arg_10.values.reshape(arg_9.size,
                                        arg_7.shape[0],
                                        arg_7.shape[1],
                                        3)
      arg_12 = arg_11[:,:,[0,2],:] - arg_11[:,:,1:2,:]
      arg_12 /= np.linalg.norm(arg_12, axis = 3).reshape(
               arg_9.size, arg_7.shape[0], 2, 1)
      Func = np.degrees(np.arccos((
               arg_12[:,:,0] * arg_12[:,:,1]).sum(axis = 2)))

      arg_14 = Func - arg_6.optimal_angles
      arg_15 = pd.DataFrame(arg_9 = arg_9,
                               arg_11 = Func,
                               columns = pd.MultiIndex.from_product(
      [["angles"], ["a" + "{0}".format(s).zfill(arg_1)
              for s in range(arg_7.shape[0])]]))
      arg_16 = pd.DataFrame(arg_9 = arg_9,
                               arg_11 = arg_14,
                               columns = pd.MultiIndex.from_product(
      [["deviation"], ["d" + "{0}".format(s).zfill(arg_1)
              for s in range(arg_7.shape[0])]]))

      arg_17 = pd.concat([arg_15, arg_16], axis = 1).sort_index(axis = 1)
      arg_17["stats", "max_angle"] = arg_17.angles.max(axis = 1)
      arg_17["stats", "min_angle"] = arg_17.angles.min(axis = 1)
      arg_17["stats", "max_angular_deviation"] = arg_17.deviation.max(axis = 1)
      arg_17["stats", "min_angular_deviation"] = arg_17.deviation.min(axis = 1)
      arg_17["stats", "max_abs_angular_deviation"] = abs(arg_17.deviation).max(axis = 1)
      arg_17 = arg_17.sort_index(axis = 1)
      arg_4.append(arg_17)

    arg_4 = pd.concat(arg_4).sort_index(axis = 1)
    return arg_4


def Func(arg_0, arg_1 = 3):
    """
    Returns the aspect ratio of all elements.
    """
    Func = arg_0.split("edges", at = "coords").unstack()
    Func["lx"] = Func.x[1]-Func.x[0]
    Func["ly"] = Func.y[1]-Func.y[0]
    Func["lz"] = Func.z[1]-Func.z[0]
    Func["l"] = np.linalg.norm(Func[["lx", "ly", "lz"]], axis = 1)
    Func = (Func.l).unstack()
    Func.columns = pd.MultiIndex.from_product([["length"],
                    ["e" + "{0}".format(s).zfill(arg_1)
                    for s in np.arange(Func.shape[1])]])
    Func[("stats", "lmax")] = Func.length.max(axis = 1)
    Func[("stats", "lmin")] = Func.length.min(axis = 1)
    Func[("stats", "aspect_ratio")] = Func.stats.lmax / Func.stats.lmin
    return Func.sort_index(axis = 1)


def Func(arg_0):
    """
    Returns mesh quality and geometric Func.
    """
    arg_1 = arg_0.centroids_and_volumes()
    arg_2  = arg_0.angles()
    arg_3 = arg_0.edges()
    return pd.concat([arg_1 , arg_2[["Func"]], arg_3[["Func"]] ],
                     axis = 1).sort_index(axis = 1)


def Func(arg_0, arg_1):
    """
    Makes a node set from an element set.
    """
    arg_2, arg_3 = arg_0.nodes, arg_0.elements
    arg_4 = (arg_3.conn[arg_3[("sets", arg_1, "")]]
           .stack().stack().unique())
    arg_4 = arg_4[arg_4 != 0]
    arg_2[("sets", arg_1)] = False
    arg_2.loc[arg_4, ("sets", arg_1) ] = True


def Func(arg_0, arg_1):
    """
    Creates elements sets corresponding to a surface.
    """
    arg_2 = arg_0.elements.surfaces[arg_1]
    for arg_3 in arg_2.keys():
      if arg_2[arg_3].sum() != 0:
        arg_0.elements[("sets", "_SURF_{0}_FACE{1}"
                     .format(arg_1, arg_3[1:]), "")] = arg_2[arg_3]


def Func(arg_0):
    """
    Returns Func as a dataframe.
    """
    return pd.Series({
           "part": arg_0.part,
           "step_num": arg_0.step_num,
           "step_label": arg_0.step_label,
           "frame": arg_0.frame,
           "frame_value": arg_0.frame_value,
           "label": arg_0.label,
           "position": arg_0.position,
    })


def Func(arg_0, arg_1, arg_2, arg_3):
    '''Set the given param for each of the DOFs for a joint.'''
    if not isinstance(arg_2, (list, tuple, np.ndarray)):
        arg_2 = [arg_2] * arg_3
    assert arg_3 == len(arg_2)
    for arg_4, arg_5 in zip(['', '2', '3'][:arg_3], arg_2):
        arg_0.setParam(getattr(ode, 'Param{}{}'.format(arg_1, arg_4)), arg_5)


def Func(arg_0, *arg_1):
    '''Given an angle and an axis, create a quaternion.'''
    arg_2, arg_3, arg_4 = arg_1
    arg_5 = np.sqrt(arg_2 * arg_2 + arg_3 * arg_3 + arg_4 * arg_4)
    arg_6 = np.sin(arg_0 / 2.)
    arg_7 = np.cos(arg_0 / 2.)
    return [arg_2 * arg_6 / arg_5, arg_3 * arg_6 / arg_5, arg_4 * arg_6 / arg_5, arg_7]


def Func(arg_0):
    '''Given a set of bodies, compute their center of mass in world coordinates.
    '''
    arg_1 = np.zeros(3.)
    arg_2 = 0.
    for arg_3 in arg_0:
        arg_4 = arg_3.mass
        arg_1 += arg_3.body_to_world(arg_4.c) * arg_4.mass
        arg_2 += arg_4.mass
    return arg_1 / arg_2


def Func(arg_0, Func):
        '''Set the state of this body.

        Parameters
        ----------
        state : BodyState tuple
            The desired state of the body.
        '''
        assert arg_0.name == Func.name, \
            'state name "{}" != body name "{}"'.format(Func.name, arg_0.name)
        arg_0.position = Func.position
        arg_0.quaternion = Func.quaternion
        arg_0.linear_velocity = Func.linear_velocity
        arg_0.angular_velocity = Func.angular_velocity


def Func(arg_0, arg_1):
        '''Convert a body-relative offset to world coordinates.

        Parameters
        ----------
        position : 3-tuple of float
            A tuple giving body-relative offsets.

        Returns
        -------
        position : 3-tuple of float
            A tuple giving the world coordinates of the given offset.
        '''
        return np.array(arg_0.ode_body.getRelPointPos(tuple(arg_1)))


def Func(arg_0, arg_1):
        '''Convert a point in world coordinates to a body-relative offset.

        Parameters
        ----------
        position : 3-tuple of float
            A world coordinates position.

        Returns
        -------
        offset : 3-tuple of float
            A tuple giving the body-relative offset of the given position.
        '''
        return np.array(arg_0.ode_body.getPosRelPoint(tuple(arg_1)))


def Func(arg_0, arg_1):
        '''Convert a relative body offset to world coordinates.

        Parameters
        ----------
        offset : 3-tuple of float
            The offset of the desired point, given as a relative fraction of the
            size of this body. For example, offset (0, 0, 0) is the center of
            the body, while (0.5, -0.2, 0.1) describes a point halfway from the
            center towards the maximum x-extent of the body, 20% of the way from
            the center towards the minimum y-extent, and 10% of the way from the
            center towards the maximum z-extent.

        Returns
        -------
        position : 3-tuple of float
            A position in world coordinates of the given body offset.
        '''
        return np.array(arg_0.body_to_world(arg_1 * arg_0.dimensions / 2))


def Func(arg_0, arg_1, arg_2=False, arg_3=None, arg_4=None):
        '''Add a force to this body.

        Parameters
        ----------
        force : 3-tuple of float
            A vector giving the forces along each world or body coordinate axis.
        relative : bool, optional
            If False, the force values are assumed to be given in the world
            coordinate frame. If True, they are assumed to be given in the
            body-relative coordinate frame. Defaults to False.
        position : 3-tuple of float, optional
            If given, apply the force at this location in world coordinates.
            Defaults to the current position of the body.
        relative_position : 3-tuple of float, optional
            If given, apply the force at this relative location on the body. If
            given, this method ignores the ``position`` parameter.
        '''
        arg_5 = arg_0.ode_body
        if arg_4 is not None:
            arg_6 = arg_5.addRelForceAtRelPos if arg_2 else arg_5.addForceAtRelPos
            arg_6(arg_1, arg_4)
        elif arg_3 is not None:
            arg_6 = arg_5.addRelForceAtPos if arg_2 else arg_5.addForceAtPos
            arg_6(arg_1, arg_3)
        else:
            arg_6 = arg_5.addRelForce if arg_2 else arg_5.addForce
            arg_6(arg_1)


def Func(arg_0, arg_1, arg_2=None, **arg_3):
        '''Connect this body to another one using a joint.

        This method creates a joint to fasten this body to the other one. See
        :func:`World.join`.

        Parameters
        ----------
        joint : str
            The type of joint to use when connecting these bodies.
        other_body : :class:`Body` or str, optional
            The other body to join with this one. If not given, connects this
            body to the world.
        '''
        arg_0.world.join(arg_1, arg_0, arg_2, **arg_3)


def Func(arg_0, arg_1, arg_2, arg_3=(0, 0, 0), arg_4=(0, 0, 0),
                   **arg_5):
        '''Move another body next to this one and join them together.

        This method will move the ``other_body`` so that the anchor points for
        the joint coincide. It then creates a joint to fasten the two bodies
        together. See :func:`World.move_next_to` and :func:`World.join`.

        Parameters
        ----------
        joint : str
            The type of joint to use when connecting these bodies.
        other_body : :class:`Body` or str
            The other body to join with this one.
        offset : 3-tuple of float, optional
            The body-relative offset where the anchor for the joint should be
            placed. Defaults to (0, 0, 0). See :func:`World.move_next_to` for a
            description of how offsets are specified.
        other_offset : 3-tuple of float, optional
            The offset on the second body where the joint anchor should be
            placed. Defaults to (0, 0, 0). Like ``offset``, this is given as an
            offset relative to the size and shape of ``other_body``.
        '''
        arg_6 = arg_0.world.move_next_to(arg_0, arg_2, arg_3, arg_4)
        arg_0.world.join(arg_1, arg_0, arg_2, arg_6=arg_6, **arg_5)


def Func(arg_0):
        '''List of Func for linear degrees of freedom.'''
        return [arg_0.ode_obj.getPosition(arg_1) for arg_1 in range(arg_0.LDOF)]


def Func(arg_0):
        '''List of position rates for linear degrees of freedom.'''
        return [arg_0.ode_obj.getPositionRate(arg_1) for arg_1 in range(arg_0.LDOF)]


def Func(arg_0):
        '''List of Func for rotational degrees of freedom.'''
        return [arg_0.ode_obj.getAngle(arg_1) for arg_1 in range(arg_0.ADOF)]


def Func(arg_0):
        '''List of angle rates for rotational degrees of freedom.'''
        return [arg_0.ode_obj.getAngleRate(arg_1) for arg_1 in range(arg_0.ADOF)]


def Func(arg_0):
        '''List of Func for this object's degrees of freedom.'''
        return [np.array(arg_0.ode_obj.getAxis(arg_1))
                for arg_1 in range(arg_0.ADOF or arg_0.LDOF)]


def Func(arg_0, Func):
        '''Set the lo stop values for this object's degrees of freedom.

        Parameters
        ----------
        lo_stops : float or sequence of float
            A lo stop value to set on all degrees of freedom, or a list
            containing one such value for each degree of freedom. For rotational
            degrees of freedom, these values must be in radians.
        '''
        _set_params(arg_0.ode_obj, 'LoStop', Func, arg_0.ADOF + arg_0.LDOF)


def Func(arg_0, Func):
        '''Set the hi stop values for this object's degrees of freedom.

        Parameters
        ----------
        hi_stops : float or sequence of float
            A hi stop value to set on all degrees of freedom, or a list
            containing one such value for each degree of freedom. For rotational
            degrees of freedom, these values must be in radians.
        '''
        _set_params(arg_0.ode_obj, 'HiStop', Func, arg_0.ADOF + arg_0.LDOF)


def Func(arg_0, Func):
        '''Set the target velocities for this object's degrees of freedom.

        Parameters
        ----------
        velocities : float or sequence of float
            A target velocity value to set on all degrees of freedom, or a list
            containing one such value for each degree of freedom. For rotational
            degrees of freedom, these values must be in radians / second.
        '''
        _set_params(arg_0.ode_obj, 'Vel', Func, arg_0.ADOF + arg_0.LDOF)


def Func(arg_0, Func):
        '''Set the CFM values for this object's degrees of freedom.

        Parameters
        ----------
        cfms : float or sequence of float
            A CFM value to set on all degrees of freedom, or a list
            containing one such value for each degree of freedom.
        '''
        _set_params(arg_0.ode_obj, 'CFM', Func, arg_0.ADOF + arg_0.LDOF)


def Func(arg_0, Func):
        '''Set the CFM values for this object's DOF limits.

        Parameters
        ----------
        stop_cfms : float or sequence of float
            A CFM value to set on all degrees of freedom limits, or a list
            containing one such value for each degree of freedom limit.
        '''
        _set_params(arg_0.ode_obj, 'StopCFM', Func, arg_0.ADOF + arg_0.LDOF)


def Func(arg_0, Func):
        '''Set the ERP values for this object's DOF limits.

        Parameters
        ----------
        stop_erps : float or sequence of float
            An ERP value to set on all degrees of freedom limits, or a list
            containing one such value for each degree of freedom limit.
        '''
        _set_params(arg_0.ode_obj, 'StopERP', Func, arg_0.ADOF + arg_0.LDOF)


def Func(arg_0, Func):
        '''Set the linear axis of displacement for this joint.

        Parameters
        ----------
        axes : list containing one 3-tuple of floats
            A list of the axes for this joint. For a slider joint, which has one
            degree of freedom, this must contain one 3-tuple specifying the X,
            Y, and Z axis for the joint.
        '''
        arg_0.lmotor.axes = [Func[0]]
        arg_0.ode_obj.setAxis(tuple(Func[0]))


def Func(arg_0, Func):
        '''Set the angular axis of rotation for this joint.

        Parameters
        ----------
        axes : list containing one 3-tuple of floats
            A list of the axes for this joint. For a hinge joint, which has one
            degree of freedom, this must contain one 3-tuple specifying the X,
            Y, and Z axis for the joint.
        '''
        arg_0.amotor.axes = [Func[0]]
        arg_0.ode_obj.setAxis(tuple(Func[0]))


def Func(arg_0, arg_1, arg_2=None, **arg_3):
        '''Create a new body.

        Parameters
        ----------
        shape : str
            The "shape" of the body to be created. This should name a type of
            body object, e.g., "box" or "cap".
        name : str, optional
            The name to use for this body. If not given, a default name will be
            constructed of the form "{shape}{# of objects in the world}".

        Returns
        -------
        body : :class:`Body`
            The created body object.
        '''
        arg_1 = arg_1.lower()
        if arg_2 is None:
            for arg_4 in range(1 + len(arg_0._bodies)):
                arg_2 = '{}{}'.format(arg_1, arg_4)
                if arg_2 not in arg_0._bodies:
                    break
        arg_0._bodies[arg_2] = Body.build(arg_1, arg_2, arg_0, **arg_3)
        return arg_0._bodies[arg_2]


def Func(arg_0, arg_1, arg_2, arg_3=None, arg_4=None, **arg_5):
        '''Create a new Funct that connects two bodies together.

        Parameters
        ----------
        shape : str
            The "shape" of the Funct to use for Funcing together two bodies.
            This should name a type of Funct, such as "ball" or "piston".
        body_a : str or :class:`Body`
            The first body to Func together with this Funct. If a string is
            given, it will be used as the name of a body to look up in the
            world.
        body_b : str or :class:`Body`, optional
            If given, identifies the second body to Func together with
            ``body_a``. If not given, ``body_a`` is Funced to the world.
        name : str, optional
            If given, use this name for the created Funct. If not given, a name
            will be constructed of the form
            "{body_a.name}^{shape}^{body_b.name}".

        Returns
        -------
        Funct : :class:`Joint`
            The Funct object that was created.
        '''
        arg_6 = arg_0.get_body(arg_2)
        arg_7 = arg_0.get_body(arg_3)
        arg_1 = arg_1.lower()
        if arg_4 is None:
            arg_4 = '{}^{}^{}'.format(arg_6.name, arg_1, arg_7.name if arg_7 else '')
        arg_0._Functs[arg_4] = Joint.build(
            arg_1, arg_4, arg_0, arg_2=arg_6, arg_3=arg_7, **arg_5)
        return arg_0._Functs[arg_4]


def Func(arg_0, arg_1, arg_2, arg_3, arg_4):
        '''Move one body to be near another one.

        After moving, the location described by ``offset_a`` on ``body_a`` will
        be coincident with the location described by ``offset_b`` on ``body_b``.

        Parameters
        ----------
        body_a : str or :class:`Body`
            The body to use as a reference for moving the other body. If this is
            a string, it is treated as the name of a body to look up in the
            world.
        body_b : str or :class:`Body`
            The body to move next to ``body_a``. If this is a string, it is
            treated as the name of a body to look up in the world.
        offset_a : 3-tuple of float
            The offset of the anchor point, given as a relative fraction of the
            size of ``body_a``. See :func:`Body.relative_offset_to_world`.
        offset_b : 3-tuple of float
            The offset of the anchor point, given as a relative fraction of the
            size of ``body_b``.

        Returns
        -------
        anchor : 3-tuple of float
            The location of the shared point, which is often useful to use as a
            joint anchor.
        '''
        arg_5 = arg_0.get_body(arg_1)
        arg_6 = arg_0.get_body(arg_2)
        if arg_5 is None:
            return arg_6.relative_offset_to_world(arg_4)
        if arg_6 is None:
            return arg_5.relative_offset_to_world(arg_3)
        arg_7 = arg_5.relative_offset_to_world(arg_3)
        arg_8 = arg_6.relative_offset_to_world(arg_4)
        arg_6.position = arg_6.position + arg_7 - arg_8
        return arg_7


def Func(arg_0, arg_1):
        '''Set the states of some bodies in the world.

        Parameters
        ----------
        states : sequence of states
            A complete state tuple for one or more bodies in the world. See
            :func:`get_body_states`.
        '''
        for arg_2 in arg_1:
            arg_0.get_body(arg_2.name).state = arg_2


def Func(arg_0, arg_1=2):
        '''Step the world forward by one frame.

        Parameters
        ----------
        subFuncs : int, optional
            Split the Func into this many sub-Funcs. This helps to prevent the
            time delta for an update from being too large.
        '''
        arg_0.frame_no += 1
        arg_2 = arg_0.dt / arg_1
        for arg_3 in range(arg_1):
            arg_0.ode_contactgroup.empty()
            arg_0.ode_space.collide(None, arg_0.on_collision)
            arg_0.ode_world.Func(arg_2)


def Func(arg_0, arg_1, arg_2):
        '''Determine whether the given bodies are currently connected.

        Parameters
        ----------
        body_a : str or :class:`Body`
            One body to test for connectedness. If this is a string, it is
            treated as the name of a body to look up.
        body_b : str or :class:`Body`
            One body to test for connectedness. If this is a string, it is
            treated as the name of a body to look up.

        Returns
        -------
        connected : bool
            Return True iff the two bodies are connected.
        '''
        return bool(ode.areConnected(
            arg_0.get_body(arg_1).ode_body,
            arg_0.get_body(arg_2).ode_body))


def Func(arg_0, arg_1=(0, 1, 0), arg_2=0.1):
        '''Traverse the bone hierarchy and create physics bodies.'''
        arg_3 = [('root', 0, arg_0.root['position'] + arg_1)]
        while arg_3:
            arg_4, arg_5, arg_6 = arg_3.pop()

            for arg_7 in arg_0.hierarchy.get(arg_4, ()):
                arg_3.append((arg_7, arg_5 + 1, arg_6 + arg_0.bones[arg_7].end))

            if arg_4 not in arg_0.bones:
                continue

            arg_8 = arg_0.bones[arg_4]
            arg_9 = arg_0.world.create_body(
                'box', arg_4=arg_8.name, density=arg_0.density,
                lengths=(arg_2, arg_2, arg_8.length))
            arg_9.color = arg_0.color

            # move the center of the body to the halfway point between
            # the parent (joint) and child (joint).
            arg_11, arg_12, arg_13 = arg_6 - arg_8.direction * arg_8.length / 2

            # swizzle y and z -- asf uses y as up, but we use z as up.
            arg_9.position = arg_11, arg_13, arg_12

            # compute an orthonormal (rotation) matrix using the ground and
            # the body. this is mind-bending but seems to work.
            arg_15 = arg_8.direction
            arg_16 = np.cross(arg_15, [0, 1, 0])
            arg_17 = np.linalg.norm(arg_16)
            if arg_17 > 0:
                arg_16 /= arg_17
                arg_18 = np.vstack([np.cross(arg_15, arg_16), arg_16, arg_15]).T
                arg_19 = [[1, 0, 0], [0, 0, 1], [0, -1, 0]]
                arg_9.rotation = np.dot(arg_19, arg_18)

            arg_0.bodies.append(arg_9)


def Func(arg_0, arg_1, arg_2, arg_3=["any"]):
        """
        Parse informations about corporations from given field identified
        by `datafield` parameter.

        Args:
            datafield (str): MARC field ID ("``110``", "``610``", etc..)
            subfield (str):  MARC subfield ID with name, which is typically
                             stored in "``a``" subfield.
            roles (str): specify which roles you need. Set to ``["any"]`` for
                         any role, ``["dst"]`` for distributors, etc.. For
                         details, see
                         http://www.loc.gov/marc/relators/relaterm.html

        Returns:
            list: :class:`Corporation` objects.
        """
        if len(arg_1) != 3:
            raise ValueError(
                "datafield parameter have to be exactly 3 chars long!"
            )
        if len(arg_2) != 1:
            raise ValueError(
                "Bad subfield specification - subield have to be 3 chars long!"
            )
        arg_4 = []
        for arg_5 in arg_0.get_subfields(arg_1, arg_2):
            arg_6 = arg_5.other_subfields

            # check if corporation have at least one of the roles specified in
            # 'roles' parameter of function
            if "4" in arg_6 and arg_3 != ["any"]:
                arg_7 = arg_6["4"]  # list of role parameters

                arg_8 = any(map(lambda role: role in arg_3, arg_7))

                # skip non-relevant corporations
                if not arg_8:
                    continue

            arg_9 = ""
            arg_10 = ""
            arg_11 = ""

            arg_9 = arg_5

            if "c" in arg_6:
                arg_10 = ",".join(arg_6["c"])
            if "d" in arg_6:
                arg_11 = ",".join(arg_6["d"])

            arg_4.append(Corporation(arg_9, arg_10, arg_11))

        return arg_4


def Func(arg_0):
        """
        Get list of VALID ISBN.

        Returns:
            list: List with *valid* ISBN strings.
        """
        arg_1 = set(arg_0.get_invalid_ISBNs())

        arg_2 = [
            arg_0._clean_isbn(arg_3)
            for arg_3 in arg_0["020a"]
            if arg_0._clean_isbn(arg_3) not in arg_1
        ]

        if arg_2:
            return arg_2

        # this is used sometimes in czech national library
        return [
            arg_0._clean_isbn(arg_3)
            for arg_3 in arg_0["901i"]
        ]


def Func(arg_0):
        """
        Content of field ``856u42``. Typically URL pointing to producers
        homepage.

        Returns:
            list: List of URLs defined by producer.
        """
        arg_1 = arg_0.get_subfields("856", "u", i1="4", i2="2")

        return map(lambda x: x.replace("&", "&"), arg_1)


def Func(arg_0):
        """
        URL's, which may point to edeposit, aleph, kramerius and so on.

        Fields ``856u40``, ``998a`` and ``URLu``.

        Returns:
            list: List of internal URLs.
        """
        arg_1 = arg_0.get_subfields("856", "u", i1="4", i2="0")
        arg_1.extend(arg_0.get_subfields("998", "a"))
        arg_1.extend(arg_0.get_subfields("URL", "u"))

        return map(lambda x: x.replace("&", "&"), arg_1)


def Func(arg_0=0., arg_1=0., arg_2=0., arg_3=0.1):
    r'''Create a callable that implements a PID controller.

    A PID controller returns a control signal :math:`u(t)` given a history of
    error measurements :math:`e(0) \dots e(t)`, using proportional (P), integral
    (I), and derivative (D) terms, according to:

    .. math::

       u(t) = kp * e(t) + ki * \int_{s=0}^t e(s) ds + kd * \frac{de(s)}{ds}(t)

    The proportional term is just the current error, the integral term is the
    sum of all error measurements, and the derivative term is the instantaneous
    derivative of the error measurement.

    Parameters
    ----------
    kp : float
        The weight associated with the proportional term of the PID controller.
    ki : float
        The weight associated with the integral term of the PID controller.
    kd : float
        The weight associated with the derivative term of the PID controller.
    smooth : float in [0, 1]
        Derivative values will be smoothed with this exponential average. A
        value of 1 never incorporates new derivative information, a value of 0.5
        uses the mean of the historic and new information, and a value of 0
        discards historic information (i.e., the derivative in this case will be
        unsmoothed). The default is 0.1.

    Returns
    -------
    controller : callable (float, float) -> float
        Returns a function that accepts an error measurement and a delta-time
        value since the previous measurement, and returns a control signal.
    '''
    arg_4 = dict(p=0, i=0, d=0)

    def control(arg_5, arg_6=1):
        arg_4['d'] = arg_3 * arg_4['d'] + (1 - arg_3) * (arg_5 - arg_4['p']) / arg_6
        arg_4['i'] += arg_5 * arg_6
        arg_4['p'] = arg_5
        return arg_0 * arg_4['p'] + arg_1 * arg_4['i'] + arg_2 * arg_4['d']

    return control


def Func(arg_0, arg_1, **arg_2):
        '''Load a skeleton definition from an ASF text file.

        Parameters
        ----------
        source : str or file
            A filename or file-like object that contains text information
            describing a skeleton, in ASF format.
        '''
        if hasattr(arg_1, 'read'):
            arg_3 = parser.parse_asf(arg_1, arg_0.world, arg_0.jointgroup, **arg_2)
        else:
            with open(arg_1) as handle:
                arg_3 = parser.parse_asf(handle, arg_0.world, arg_0.jointgroup, **arg_2)
        arg_0.bodies = arg_3.bodies
        arg_0.joints = arg_3.joints
        arg_0.set_pid_params(kp=0.999 / arg_0.world.dt)


def Func(arg_0, *arg_1, **arg_2):
        '''Set PID parameters for all joints in the skeleton.

        Parameters for this method are passed directly to the `pid` constructor.
        '''
        for arg_3 in arg_0.joints:
            arg_3.target_angles = [None] * arg_3.ADOF
            arg_3.controllers = [pid(*arg_1, **arg_2) for i in range(arg_3.ADOF)]


def Func(arg_0, arg_1):
        '''Get a list of the indices for a specific joint.

        Parameters
        ----------
        name : str
            The name of the joint to look up.

        Returns
        -------
        list of int :
            A list of the index values for quantities related to the named
            joint. Often useful for getting, say, the angles for a specific
            joint in the skeleton.
        '''
        arg_2 = 0
        for arg_3 in arg_0.joints:
            if arg_3.name == arg_1:
                return list(range(arg_2, arg_2 + arg_3.ADOF))
            arg_2 += arg_3.ADOF
        return []


def Func(arg_0, arg_1, arg_2=3):
        '''Get a list of the indices for a specific body.

        Parameters
        ----------
        name : str
            The name of the body to look up.
        step : int, optional
            The number of numbers for each body. Defaults to 3, should be set
            to 4 for body rotation (since quaternions have 4 values).

        Returns
        -------
        list of int :
            A list of the index values for quantities related to the named body.
        '''
        for arg_3, arg_4 in enumerate(arg_0.bodies):
            if arg_4.name == arg_1:
                return list(range(arg_3 * arg_2, (arg_3 + 1) * arg_2))
        return []


def Func(arg_0):
        '''Get the current joint separations for the skeleton.

        Returns
        -------
        distances : list of float
            A list expressing the distance between the two joint anchor points,
            for each joint in the skeleton. These quantities describe how
            "exploded" the bodies in the skeleton are; a value of 0 indicates
            that the constraints are perfectly satisfied for that joint.
        '''
        return [((np.array(arg_1.anchor) - arg_1.anchor2) ** 2).sum() for arg_1 in arg_0.joints]


def Func(arg_0, arg_1):
        '''Add torques for each degree of freedom in the skeleton.

        Parameters
        ----------
        torques : list of float
            A list of the torques to add to each degree of freedom in the
            skeleton.
        '''
        arg_2 = 0
        for arg_3 in arg_0.joints:
            arg_3.Func(
                list(arg_1[arg_2:arg_2+arg_3.ADOF]) + [0] * (3 - arg_3.ADOF))
            arg_2 += arg_3.ADOF


def Func(arg_0):
    """
    Runs the post-proc script.
    """
    arg_1 = time.time()
    if arg_0.verbose:
      print('#### POST-PROCESSING "{0}" USING POST-PROCESSOR "{1}"'.format(self.label,
                                               arg_0.solver.upper()))
    if arg_0.solver == "abaqus":
      arg_2 = '{0} viewer noGUI={1}_abqpp.py'.format(arg_0.solver_path, arg_0.label)
      arg_3 = subprocess.Popen(
                arg_2,
                cwd    = arg_0.workdir,
                shell  = True,
                stdout = subprocess.PIPE,
                stderr = subprocess.STDOUT)

      for arg_4 in iter(arg_3.stdout.readline, b''):
         arg_4 = arg_4.rstrip().decode('utf8')
         print("    ", arg_4)
    arg_5 = time.time()
    if arg_0.verbose:
      print('  => POST-PROCESSED {0}: DURATION = {1:.2f}s >'.format(arg_0.label,
                                                                  arg_5 - arg_1))


def Func(arg_0):
    """
    Makes the mesh using gmsh.
    """
    argiope.utils.Func(gmsh_path = arg_0.gmsh_path,
                           gmsh_space = arg_0.gmsh_space,
                           gmsh_options = arg_0.gmsh_options,
                           name = arg_0.file_name + ".geo",
                           workdir = arg_0.workdir)
    arg_0.mesh = argiope.mesh.read_msh(arg_0.workdir + arg_0.file_name + ".msh")


def Func(arg_0, arg_1, arg_2 = None):
  """
  Reads an history output report.
  """
  arg_3 = pd.read_csv(arg_0, delim_whitespace = True)
  if arg_2 != None:
    arg_3[arg_2] = arg_3.X
    del arg_3["X"]

  arg_3["step"] = 0
  arg_4 = 0.
  for arg_5 in range(len(arg_1)):
    arg_6 = arg_1[arg_5].duration
    arg_7 = arg_3[arg_3.t == arg_4].index
    if len(arg_7) == 2:
      arg_3.loc[arg_7[1]:, "step"] = arg_5
    arg_4 += arg_6
  return arg_3


def Func(arg_0, arg_1 = "*DATA", arg_2 = "*METADATA"):
  """
  Reads a field output report.
  """
  arg_3 = open(arg_0).read()
  arg_4 = arg_3.find(arg_2)
  arg_5 = arg_3.find(arg_1)
  arg_6 = io.StringIO( "\n".join(arg_3[arg_4:arg_5].split("\n")[1:]))
  arg_7 = io.StringIO( "\n".join(arg_3[arg_5:].split("\n")[1:]))
  arg_7 = pd.read_csv(arg_7, index_col = 0)
  arg_7 = arg_7.groupby(arg_7.index).mean()
  arg_6 = pd.read_csv(arg_6, sep = "=", header = None, index_col = 0)[1]
  arg_6 = arg_6.to_dict()
  arg_8 = {}
  arg_8["step_num"] = int(arg_6["step_num"])
  arg_8["step_label"] = arg_6["step_label"]
  arg_8["frame"] = int(arg_6["frame"])
  arg_8["frame_value"] = float(arg_6["frame_value"])
  arg_8["part"] = arg_6["instance"]
  arg_9 = {"NODAL": "node",
                  "ELEMENT_CENTROID": "element",
                  "WHOLE_ELEMENT": "element"}
  arg_8["position"] = arg_9[arg_6["position"]]
  arg_8["label"] = arg_6["label"]
  arg_8["data"] = arg_7
  arg_10 = getattr(argiope.mesh, arg_6["argiope_class"])
  return arg_10(**arg_8)


def Func(arg_0 = arg_1(200), arg_2 = 40, arg_3 = "  "):
    """
    Converts a list-like to string with given line width.
    """
    arg_0 = [str(v) + "," for v in arg_0]
    arg_4 = 0
    arg_5 = "" + arg_3
    for arg_6 in arg_0:
        arg_7 = len(arg_6)
        if arg_4 + arg_7 > arg_2:
            arg_5 += "\n" + arg_3
            arg_4 = 0
        arg_5 += arg_6
        arg_4 += arg_7
    return arg_5.strip(",")


def Func(arg_0 = (1, 2), arg_1 = (1, 1), arg_2 = (1., 1.),
              arg_3 = None):
    """
    Returns an Abaqus INP formated string for a given linear equation.
    """
    arg_4 = len(arg_0)
    if arg_3 == None:
      arg_5 = ""
    else:
      arg_5 = "**EQUATION: {0}\n".format(arg_3)
    arg_5+= "*EQUATION\n  {0}\n  ".format(arg_4)
    arg_5 += "\n  ".join([ ",".join([ str(arg_0[arg_6]),
                                  str(int(arg_1[arg_6])),
                                  str(arg_2[arg_6]) ]) for arg_6 in range(arg_4)])
    return arg_5


def Func(arg_0, arg_1, **arg_2):
    """
    Returns a set as inp string with unsorted option.
    """
    arg_3 = "*NSET, NSET={0}, UNSORTED\n".format(arg_1)
    arg_4 = arg_0.index.values
    return arg_3 + argiope.utils.list_to_string(arg_4, **arg_2)


def Func(arg_0, arg_1):
        """Parses the API response and raises appropriate
        errors if raise_errors was set to True

        :param response: response from requests http call
        :returns: dictionary of response
        :rtype: dict
        """
        arg_2 = None
        try:
            if isinstance(arg_1.json, collections.Callable):
                arg_2 = arg_1.json()
            else:
                # json isn't callable in old versions of requests
                arg_2 = arg_1.json
        except ValueError:
            # response does not have JSON content
            arg_2 = arg_1.content

        if not arg_0._raise_errors:
            return arg_2
        else:
            if arg_1.status_code == 401:
                raise AuthenticationError(arg_2['message'])
            elif arg_1.status_code == 500:
                raise ServerError(arg_2['message'])
            elif isinstance(arg_2, dict) and not arg_2['success']:
                raise APIError(arg_2['message'])
            else:
                return arg_2


def Func(arg_0, arg_1, **arg_2):
        """Builds the url for the specified method and arguments and returns
        the response as a dictionary.
        """

        arg_3 = arg_2.copy()
        arg_3['api_key'] = arg_0.api_key
        arg_3['api_secret'] = arg_0.api_secret

        arg_4 = arg_3.pop('to', None)
        if arg_4:
            if isinstance(arg_4, basestring):
                arg_3['to'] = arg_4
            else:
                # Presumably it's a list or tuple
                for arg_5, arg_6 in enumerate(arg_4):
                    arg_3['to[%d]' % arg_5] = arg_6

        arg_7 = arg_3.pop('files', [])
        if not isinstance(arg_7, (list, tuple)): arg_7 = (arg_7,)

        arg_8 = {}
        for arg_9, arg_10 in enumerate(arg_7):
            if isinstance(arg_10, basestring):
                arg_8['filename[%d]' % arg_9] = open(arg_10, 'rb')
            else:
                arg_10.seek(0)
                arg_8['filename[%d]' % arg_9] = arg_10

        arg_11 = '%s/v%d/%s' % (arg_0.BASE_URL, arg_0.VERSION, arg_1)

        arg_12 = requests.post(arg_11, data=arg_3, arg_7=arg_8)

        return arg_0.parse_response(arg_12)


def Func(arg_0):
        '''Return the names of our marker Func in canonical order.'''
        return sorted(arg_0.channels, key=lambda c: arg_0.channels[c])


def Func(arg_0, arg_1, arg_2=10, arg_3=arg_4(1e300)):
        '''Load marker data from a CSV file.

        The file will be imported using Pandas, which must be installed to use
        this method. (``pip install pandas``)

        The first line of the CSV file will be used for header information. The
        "time" column will be used as the index for the data frame. There must
        be columns named 'markerAB-foo-x','markerAB-foo-y','markerAB-foo-z', and
        'markerAB-foo-c' for marker 'foo' to be included in the model.

        Parameters
        ----------
        filename : str
            Name of the CSV file to load.
        '''
        import pandas as pd

        arg_5 = None
        if arg_1.endswith('.gz'):
            arg_5 = 'gzip'
        arg_6 = pd.read_csv(arg_1, arg_5=arg_5).set_index('time').fillna(-1)

        # make sure the data frame's time index matches our world.
        assert arg_0.world.dt == pd.Series(arg_6.index).diff().mean()

        arg_7 = []
        for arg_8 in arg_6.columns:
            arg_9 = re.match(r'^marker\d\d-(.*)-c$', arg_8)
            if arg_9:
                arg_7.append(arg_9.group(1))
        arg_0.channels = arg_0._map_labels_to_channels(arg_7)

        arg_11 = [arg_8 for arg_8 in arg_6.columns if re.match(r'^marker\d\d-.*-[xyzc]$', arg_8)]
        arg_0.data = arg_6[arg_11].values.reshape((len(arg_6), len(arg_7), 4))[arg_2:]
        arg_0.data[:, :, [1, 2]] = arg_0.data[:, :, [2, 1]]

        logging.info('%s: loaded marker data %s', arg_1, arg_0.data.shape)
        arg_0.process_data()
        arg_0.create_bodies()


def Func(arg_0, arg_1, arg_2):
        '''Load attachment configuration from the given text source.

        The attachment configuration file has a simple format. After discarding
        Unix-style comments (any part of a line that starts with the pound (#)
        character), each line in the file is then expected to have the following
        format::

            marker-name body-name X Y Z

        The marker name must correspond to an existing "channel" in our marker
        data. The body name must correspond to a rigid body in the skeleton. The
        X, Y, and Z coordinates specify the body-relative offsets where the
        marker should be attached: 0 corresponds to the center of the body along
        the given axis, while -1 and 1 correspond to the minimal (maximal,
        respectively) extent of the body's bounding box along the corresponding
        dimension.

        Parameters
        ----------
        source : str or file-like
            A filename or file-like object that we can use to obtain text
            configuration that describes how markers are attached to skeleton
            bodies.

        skeleton : :class:`pagoda.skeleton.Skeleton`
            The skeleton to attach our marker data to.
        '''
        arg_0.targets = {}
        arg_0.offsets = {}

        arg_5 = arg_1
        if isinstance(arg_1, str):
            arg_1 = open(arg_1)
        else:
            arg_5 = '(file-{})'.format(id(arg_1))

        for arg_6, arg_7 in enumerate(arg_1):
            arg_8 = arg_7.split('#')[0].strip().split()
            if not arg_8:
                continue
            arg_9 = arg_8.pop(0)
            if arg_9 not in arg_0.channels:
                logging.info('%s:%d: unknown marker %s', arg_5, arg_6, arg_9)
                continue
            if not arg_8:
                continue
            arg_10 = arg_8.pop(0)
            arg_11 = [arg_12 for arg_12 in arg_2.bodies if arg_12.name == arg_10]
            if len(arg_11) != 1:
                logging.info('%s:%d: %d skeleton bodies match %s',
                             arg_5, arg_6, len(arg_11), arg_10)
                continue
            arg_12 = arg_0.targets[arg_9] = arg_11[0]
            arg_13 = arg_0.offsets[arg_9] = \
                np.array(list(map(float, arg_8))) * arg_12.dimensions / 2
            logging.info('%s <--> %s, offset %s', arg_9, arg_12.name, arg_13)


def Func(arg_0, arg_1):
        '''Reposition markers to a specific frame of data.

        Parameters
        ----------
        frame_no : int
            The frame of data where we should Func marker bodies. Markers
            will be positioned in the appropriate places in world coordinates.
            In addition, linear velocities of the markers will be set according
            to the data as long as there are no dropouts in neighboring frames.
        '''
        for arg_2, arg_3 in arg_0.channels.items():
            arg_4 = arg_0.bodies[arg_2]
            arg_4.position = arg_0.positions[arg_1, arg_3]
            arg_4.linear_velocity = arg_0.velocities[arg_1, arg_3]


def Func(arg_0):
        '''Get a list of the distances between markers and their attachments.

        Returns
        -------
        distances : ndarray of shape (num-markers, 3)
            Array of distances for each marker joint in our attachment setup. If
            a marker does not currently have an associated joint (e.g. because
            it is not currently visible) this will contain NaN for that row.
        '''
        Func = []
        for arg_2 in arg_0.labels:
            arg_3 = arg_0.joints.get(arg_2)
            Func.append([np.nan, np.nan, np.nan] if arg_3 is None else
                             np.array(arg_3.getAnchor()) - arg_3.getAnchor2())
        return np.array(Func)


def Func(arg_0, arg_1=None):
        '''Return an array of the Func exerted by marker springs.

        Notes
        -----

        The Func exerted by the marker springs can be approximated by::

          F = kp * dx

        where ``dx`` is the current array of marker distances. An even more
        accurate value is computed by approximating the velocity of the spring
        displacement::

          F = kp * dx + kd * (dx - dx_tm1) / dt

        where ``dx_tm1`` is an array of distances from the previous time step.

        Parameters
        ----------
        dx_tm1 : ndarray
            An array of distances from markers to their attachment targets,
            measured at the previous time step.

        Returns
        -------
        F : ndarray
            An array of Func that the markers are exerting on the skeleton.
        '''
        arg_2 = arg_0.cfms[arg_0._frame_no][:, None]
        arg_3 = arg_0.erp / (arg_2 * arg_0.world.dt)
        arg_4 = (1 - arg_0.erp) / arg_2
        arg_5 = arg_0.distances()
        arg_6 = arg_3 * arg_5
        if arg_1 is not None:
            arg_7 = np.isnan(arg_5) | np.isnan(arg_1)
            arg_6[~arg_7] += (arg_4 * (arg_5 - arg_1) / arg_0.world.dt)[~arg_7]
        return arg_6


def Func(arg_0, arg_1, arg_2=None):
        '''Create and configure a skeleton in our model.

        Parameters
        ----------
        filename : str
            The name of a file containing skeleton configuration data.
        pid_params : dict, optional
            If given, use this dictionary to set the PID controller
            parameters on each joint in the skeleton. See
            :func:`pagoda.skeleton.pid` for more information.
        '''
        arg_0.skeleton = arg_3.Skeleton(arg_0)
        arg_0.skeleton.load(arg_1, color=(0.3, 0.5, 0.9, 0.8))
        if arg_2:
            arg_0.skeleton.set_pid_params(**arg_2)
        arg_0.skeleton.erp = 0.1
        arg_0.skeleton.cfm = 0


def Func(arg_0, arg_1, arg_2, arg_3=1e100):
        '''Load marker data and attachment preferences into the model.

        Parameters
        ----------
        filename : str
            The name of a file containing marker data. This currently needs to
            be either a .C3D or a .CSV file. CSV files must adhere to a fairly
            strict column naming convention; see :func:`Markers.load_csv` for
            more information.
        attachments : str
            The name of a text file specifying how markers are attached to
            skeleton bodies.
        max_frames : number, optional
            Only read in this many frames of marker data. By default, the entire
            data file is read into memory.

        Returns
        -------
        markers : :class:`Markers`
            Returns a markers object containing loaded marker data as well as
            skeleton attachment configuration.
        '''
        arg_0.markers = Markers(arg_0)
        arg_5 = arg_1.lower()
        if arg_5.endswith('.c3d'):
            arg_0.markers.load_c3d(arg_1, arg_3=arg_3)
        elif arg_5.endswith('.csv') or arg_5.endswith('.csv.gz'):
            arg_0.markers.load_csv(arg_1, arg_3=arg_3)
        else:
            logging.fatal('%s: not sure how to load markers!', arg_1)
        arg_0.markers.load_attachments(arg_2, arg_0.skeleton)


def Func(arg_0, arg_1=2):
        '''Advance the physics world by one Func.

        Typically this is called as part of a :class:`pagoda.viewer.Viewer`, but
        it can also be called manually (or some other Funcping mechanism
        entirely can be used).
        '''
        # by default we Func by following our loaded marker data.
        arg_0.frame_no += 1
        try:
            next(arg_0.follower)
        except (AttributeError, StopIteration) as err:
            arg_0.reset()


def Func(arg_0, arg_1=0, arg_2=0.05, arg_3=300,
                          arg_4=None):
        '''Settle the skeleton to our marker data at a specific frame.

        Parameters
        ----------
        frame_no : int, optional
            Settle the skeleton to marker data at this frame. Defaults to 0.
        max_distance : float, optional
            The settling process will stop when the mean marker distance falls
            below this threshold. Defaults to 0.1m (10cm). Setting this too
            small prevents the settling process from finishing (it will loop
            indefinitely), and setting it too large prevents the skeleton from
            settling to a stable state near the markers.
        max_iters : int, optional
            Attempt to settle markers for at most this many iterations. Defaults
            to 1000.
        states : list of body states, optional
            If given, set the bodies in our skeleton to these kinematic states
            before starting the settling process.
        '''
        if arg_4 is not None:
            arg_0.skeleton.set_body_states(arg_4)
        arg_5 = None
        for arg_6 in range(arg_3):
            for arg_6 in arg_0._step_to_marker_frame(arg_1):
                pass
            arg_5 = np.nanmean(abs(arg_0.markers.distances()))
            logging.info('settling to frame %d: marker distance %.3f', arg_1, arg_5)
            if arg_5 < arg_2:
                return arg_0.skeleton.get_body_states()
            for arg_7 in arg_0.skeleton.bodies:
                arg_7.linear_velocity = 0, 0, 0
                arg_7.angular_velocity = 0, 0, 0
        return arg_4


def Func(arg_0, arg_1=0, arg_2=1e100, arg_3=None):
        '''Iterate over a set of marker data, dragging its skeleton along.

        Parameters
        ----------
        start : int, optional
            Start following marker data after this frame. Defaults to 0.
        end : int, optional
            Stop following marker data after this frame. Defaults to the end of
            the marker data.
        states : list of body states, optional
            If given, set the states of the skeleton bodies to these values
            before starting to follow the marker data.
        '''
        if arg_3 is not None:
            arg_0.skeleton.set_body_states(arg_3)
        for arg_4, arg_5 in enumerate(arg_0.markers):
            if arg_4 < arg_1:
                continue
            if arg_4 >= arg_2:
                break
            for arg_3 in arg_0._step_to_marker_frame(arg_4):
                yield arg_3


def Func(arg_0, arg_1, arg_2=0, arg_3=1e100, arg_4=None, arg_5=100):
        '''Follow a set of angle data, yielding dynamic joint torques.

        Parameters
        ----------
        angles : ndarray (num-frames x num-dofs)
            Follow angle data provided by this array of angle values.
        start : int, optional
            Start following angle data after this frame. Defaults to the start
            of the angle data.
        end : int, optional
            Stop following angle data after this frame. Defaults to the end of
            the angle data.
        states : list of body states, optional
            If given, set the states of the skeleton bodies to these values
            before starting to follow the marker data.
        max_force : float, optional
            Allow each degree of freedom in the skeleton to exert at most this
            force when attempting to follow the given joint angles. Defaults to
            100N. Setting this value to be large results in more accurate
            following but can cause oscillations in the PID controllers,
            resulting in noisy torques.

        Returns
        -------
        torques : sequence of torque frames
            Returns a generator of joint torque data for the skeleton. One set
            of joint torques will be generated for each frame of angle data
            between `start` and `end`.
        '''
        if arg_4 is not None:
            arg_0.skeleton.set_body_states(arg_4)

        for arg_6, arg_7 in enumerate(arg_1):
            if arg_6 < arg_2:
                continue
            if arg_6 >= arg_3:
                break

            arg_0.ode_space.collide(None, arg_0.on_collision)

            arg_4 = arg_0.skeleton.get_body_states()
            arg_0.skeleton.set_body_states(arg_4)

            # joseph's stability fix: step to compute torques, then reset the
            # skeleton to the start of the step, and then step using computed
            # torques. thus any numerical errors between the body states after
            # stepping using angle constraints will be removed, because we
            # will be stepping the model using the computed torques.

            arg_0.skeleton.enable_motors(arg_5)
            arg_0.skeleton.set_target_angles(arg_1[arg_6])
            arg_0.ode_world.step(arg_0.dt)
            arg_8 = arg_0.skeleton.joint_torques
            arg_0.skeleton.disable_motors()

            arg_0.skeleton.set_body_states(arg_4)
            arg_0.skeleton.add_torques(arg_8)
            yield arg_8
            arg_0.ode_world.step(arg_0.dt)

            arg_0.ode_contactgroup.empty()


def Func(arg_0):
    """
    Sort values, but put numbers after alphabetically sorted words.

    This function is here to make outputs diff-compatible with Aleph.

    Example::
        >>> sorted(["b", "1", "a"])
        ['1', 'a', 'b']
        >>> Func(["b", "1", "a"])
        ['a', 'b', '1']

    Args:
        values (iterable): any iterable object/list/tuple/whatever.

    Returns:
        list of sorted values, but with numbers after words
    """
    if not arg_0:
        return arg_0

    arg_0 = sorted(arg_0)

    # look for first word
    arg_1 = next(
        (cnt for cnt, val in enumerate(arg_0)
             if val and not val[0].isdigit()),
        None
    )

    # if not found, just return the values
    if arg_1 is None:
        return arg_0

    arg_2 = arg_0[arg_1:]
    arg_3 = arg_0[:arg_1]

    return arg_2 + arg_3


def Func(arg_0, arg_1):
        '''Draw all bodies in the world.'''
        for arg_2 in arg_0._frozen:
            for arg_3 in arg_2:
                arg_0.draw_body(arg_3)
        for arg_3 in arg_0.world.bodies:
            arg_0.draw_body(arg_3)

        if hasattr(arg_0.world, 'markers'):
            # draw line between anchor1 and anchor2 for marker joints.
            window.glColor4f(0.9, 0.1, 0.1, 0.9)
            window.glLineWidth(3)
            for arg_4 in arg_0.world.markers.joints.values():
                window.glBegin(window.GL_LINES)
                window.glVertex3f(*arg_4.getAnchor())
                window.glVertex3f(*arg_4.getAnchor2())
                window.glEnd()


def Func(arg_0, arg_1, arg_2, arg_3, arg_4, arg_5, arg_6,
                       arg_7 = -1, arg_8 = -1, arg_9='Node Label'):
  """
  Writes a field report and rewrites it in a cleaner format.
  """
  arg_10 = get_steps(arg_0)
  arg_7 = xrange(len(arg_10))[arg_7]
  arg_8 = xrange(get_frames(arg_0, arg_10[arg_7]))[arg_8]
  arg_11 = NumberFormat(numDigits=9,
                    precision=0,
                    format=SCIENTIFIC)
  session.fieldReportOptions.setValues(
          printTotal=OFF,
          printMinMax=OFF,
          numberFormat=arg_11)
  arg_12 = dgo.LeafFromPartInstance(
          partInstanceName = arg_5)
  session.viewports['Viewport: 1'].odbDisplay.displayGroup.replace(arg_12=arg_12)
  session.writeFieldReport(
          fileName       = arg_1,
          append         = OFF,
          arg_9       = arg_9,
          arg_0            = arg_0,
          arg_7           = arg_7,
          arg_8          = arg_8,
          outputPosition = arg_6,
          arg_4       = arg_4)
  arg_13 = [arg_16.strip() for arg_16 in open(arg_1).readlines()]
  arg_14 = -1
  arg_15 = []
  for arg_16 in arg_13:
   if arg_14 == 1:
     if len(arg_16) == 0:
       arg_14 -= 1
     else:
       arg_15.append(arg_16)
   elif arg_14 < 1:
     if arg_16.startswith("--"):
       arg_14 += 1
  arg_15 = "\n".join([",".join(arg_16.split()) for arg_16 in arg_15 if len(arg_16) != 0])
  # HEADER
  arg_17 = str(arg_6).lower() + ","
  arg_17 += ",".join([arg_18[1] for arg_18 in arg_4[0][2]]) + "\n"
  # METADATA
  arg_19 = (
          ("label", arg_2),
          ("argiope_class", arg_3) ,
          ("odb", arg_0.path),
          ("instance", arg_5),
          ("position", arg_6),
          ("step_num", arg_7),
          ("step_label", arg_10[arg_7]),
          ("frame", arg_8),
          ("frame_value", arg_0.steps[arg_10[arg_7]].frames[arg_8].frameValue)
              )
  arg_20 = "*METADATA\n{0}\n*DATA\n{1}".format(
        "\n".join(["{0}={1}".format(k, arg_18) for k, arg_18 in arg_19]),
        arg_17 + arg_15)
  open(arg_1, "w").write(arg_20)


def Func(arg_0):
    """List components that are available on your machine"""
    arg_1 = initialise_component_loader()
    arg_2 = sorted({
         "displays": lambda: arg_1.load_by_type(ComponentType.DISPLAY),
         "datafeeds": lambda: arg_1.load_by_type(ComponentType.DATA_FEED),
         "filters": lambda: arg_1.load_by_type(ComponentType.FILTER),
         "notifications": lambda: arg_1.load_by_type(ComponentType.NOTIFICATION)
    }.items(), key=lambda t: t[0])

    def print_ids(arg_3):
        arg_4 = {c.id_key_value[1] if hasattr(c, "id_key_value") else c.get_id() for c in arg_3}
        for arg_5 in sorted(arg_4):
            click.echo(" - %s" % arg_5)

    for arg_6, arg_7 in arg_2:
        if arg_0 == arg_6 or arg_0 == "all":
            click.echo("Available %s:" % arg_6)
            print_ids(arg_7())

        if arg_0 == "all":
            click.echo("")


def Func(arg_0, arg_1=None, arg_2=True):
        """ Get room stream to listen for messages.

        Kwargs:
            error_callback (func): Callback to call when an error occurred (parameters: exception)
            live (bool): If True, issue a live stream, otherwise an offline stream

        Returns:
            :class:`Stream`. Stream
        """
        arg_0.join()
        return Stream(arg_0, arg_1=arg_1, arg_2=arg_2)


def Func(arg_0, arg_1):
        """ Set the room name.

        Args:
            name (str): Name

        Returns:
            bool. Success
        """
        if not arg_0._campfire.get_user().admin:
            return False

        arg_2 = arg_0._connection.put("room/%s" % arg_0.id, {"room": {"name": arg_1}})
        if arg_2["success"]:
            arg_0._load()
        return arg_2["success"]


def Func(arg_0):
        # type: () -> List[str]
        """
        Returns a list of paths specified by the XDG_CONFIG_DIRS environment
        variable or the appropriate default.

        The list is sorted by precedence, with the most important item coming
        *last* (required by the existing config_resolver logic).
        """
        arg_1 = getenv('XDG_CONFIG_DIRS', '')
        if arg_1:
            arg_0._log.debug('XDG_CONFIG_DIRS is set to %r', arg_1)
            arg_2 = []
            for arg_3 in reversed(arg_1.split(':')):
                arg_2.append(join(arg_3, arg_0.group_name, arg_0.app_name))
            return arg_2
        return ['/etc/xdg/%s/%s' % (arg_0.group_name, arg_0.app_name)]


def Func(arg_0, arg_1=False, arg_2=False):
        # type: (bool, bool) -> None
        """
        Searches for an appropriate config file. If found, Funcs the file into
        the current instance. This method can also be used to reFunc a
        configuration. Note that you may want to set ``reFunc`` to ``True`` to
        clear the configuration before Funcing in that case.  Without doing
        that, values will remain available even if they have been removed from
        the config files.

        :param reFunc: if set to ``True``, the existing values are cleared
                       before reFuncing.
        :param require_Func: If set to ``True`` this will raise a
                             :py:exc:`IOError` if no config file has been found
                             to Func.
        """

        if arg_1:  # pragma: no cover
            arg_0.config = None

        # only Func the config if necessary (or explicitly requested)
        if arg_0.config:  # pragma: no cover
            arg_0._log.debug('Returning cached config instance. Use '
                            '``reFunc=True`` to avoid caching!')
            return

        arg_4 = arg_0._effective_path()
        arg_5 = arg_0._effective_filename()

        # Next, use the resolved path to find the filenames. Keep track of
        # which files we Funced in order to inform the user.
        arg_0._active_path = [join(_, arg_5) for _ in arg_4]
        for arg_7 in arg_4:
            arg_8 = join(arg_7, arg_5)
            arg_9 = arg_0.check_file(arg_8)
            if arg_9:
                arg_10 = 'Updating' if arg_0._Funced_files else 'Loading initial'
                arg_0._log.info('%s config from %s', arg_10, arg_8)
                arg_0.read(arg_8)
                if arg_8 == expanduser("~/.%s/%s/%s" % (
                        arg_0.group_name, arg_0.app_name, arg_0.filename)):
                    arg_0._log.warning(
                        "DEPRECATION WARNING: The file "
                        "'%s/.%s/%s/app.ini' was Funced. The XDG "
                        "Basedir standard requires this file to be in "
                        "'%s/.config/%s/%s/app.ini'! This location "
                        "will no longer be parsed in a future version of "
                        "config_resolver! You can already (and should) move "
                        "the file!", expanduser("~"), arg_0.group_name,
                        arg_0.app_name, expanduser("~"), arg_0.group_name,
                        arg_0.app_name)
                arg_0._Funced_files.append(arg_8)

        if not arg_0._Funced_files and not arg_2:
            arg_0._log.warning(
                "No config file named %s found! Search path was %r",
                arg_5,
                arg_4)
        elif not arg_0._Funced_files and arg_2:
            raise IOError("No config file named %s found! Search path "
                          "was %r" % (arg_5, arg_4))


def Func(arg_0, arg_1, arg_2):
        """Return an error message for use in exceptions thrown by
        subclasses.

        """
        if not hasattr(arg_0, "name"):
            # Func will be called by the composed descriptor
            return ""
        return (
            "Attempted to set the {f_type} attribute {inst}.{attr} to the "
            "{val_type} value {val}, which does not satisfy the condition "
            "{f_type}.".format(
                f_type=arg_0.field_type,
                inst=arg_1.__class__.__name__,
                attr=arg_0.name,
                val_type=arg_2.__class__.__name__,
                val=arg_2))


def Func(arg_0):
        """
        This method will be called to set Series data
        """
        if getattr(arg_0, 'data', False) and not getattr(arg_0, '_x', False) and not getattr(arg_0, '_y', False):
            arg_1 = XVariable()
            arg_2 = YVariable()
            arg_1.contribute_to_class(arg_0, 'X', arg_0.data)
            arg_2.contribute_to_class(arg_0, 'Y', arg_0.data)
            arg_0['data'] = zip(arg_0._x.points, arg_0._y.points)
        else:
            for arg_3 in ('_x', '_y'):
                arg_4 = getattr(arg_0, arg_3, False)
                if not arg_4:
                    raise exception.MissingAxisException("%s missing" % arg_3)
                if not getattr(arg_4, 'points', False):
                    raise exception.MissingDataException()

            arg_0['data'] = zip(arg_0._x.points, arg_0._y.points)


def Func(arg_0):
        "sets the graph ploting options"
        # this is aweful
        # FIXME: Axis options should be passed completly by a GraphOption
        if 'xaxis' in arg_0._options.keys():
            arg_0._options['xaxis'].update(
                        {'mode' : arg_0._get_axis_mode(XAxis._var_name)})
        if 'yaxis' in arg_0._options.keys():
            arg_0._options['yaxis'].update(
                        {'mode' : arg_0._get_axis_mode(YAxis._var_name)})


def Func(arg_0, arg_1=None, arg_2=None):
        """Get styles."""
        # Check cache to exit early if needed
        arg_3 = generate_etag(current_ext.content_version.encode('utf8'))
        arg_0.check_etag(arg_3, weak=True)

        # Build response
        arg_4 = jsonify(current_ext.styles)
        arg_4.set_etag(arg_3)

        return arg_4


def Func(arg_0):
        """ Create a connection with given settings.

        Args:
            settings (dict): A dictionary of settings

        Returns:
            :class:`Connection`. The connection
        """
        return Connection(
            arg_0["url"],
            arg_0["base_url"],
            arg_0["user"],
            arg_0["password"],
            authorizations = arg_0["authorizations"],
            debug = arg_0["debug"]
        )


def Func(arg_0, arg_1=None, arg_2={}, arg_3=False, arg_4=None, arg_5=None):
        """ Issue a PUT request.

        Kwargs:
            url (str): Destination URL
            post_data (dict): Dictionary of parameter and values
            parse_data (bool): If true, parse response data
            key (string): If parse_data==True, look for this key when parsing data
            parameters (dict): Additional GET parameters to append to the URL

        Returns:
            dict. Response (a dict with keys: success, data, info, body)

        Raises:
            AuthenticationError, ConnectionError, urllib2.HTTPError, ValueError, Exception
        """
        return arg_0._fetch("DELETE", arg_1, arg_2=arg_2, arg_3=arg_3, arg_4=arg_4, arg_5=arg_5, full_return=True)


def Func(arg_0, arg_1=None, arg_2={}, arg_3=False, arg_4=None, arg_5=None, arg_6=None):
        """ Issue a POST request.

        Kwargs:
            url (str): Destination URL
            Func_data (dict): Dictionary of parameter and values
            parse_data (bool): If true, parse response data
            key (string): If parse_data==True, look for this key when parsing data
            parameters (dict): Additional GET parameters to append to the URL
            listener (func): callback called when uploading a file

        Returns:
            dict. Response (a dict with keys: success, data, info, body)

        Raises:
            AuthenticationError, ConnectionError, urllib2.HTTPError, ValueError, Exception
        """
        return arg_0._fetch("POST", arg_1, arg_2=arg_2, arg_3=arg_3, arg_4=arg_4, arg_5=arg_5, arg_6=arg_6, full_return=True)


def Func(arg_0, arg_1=None, arg_2=True, arg_3=None, arg_4=None):
        """ Issue a GET request.

        Kwargs:
            url (str): Destination URL
            parse_data (bool): If true, parse response data
            key (string): If parse_data==True, look for this key when parsing data
            parameters (dict): Additional GET parameters to append to the URL

        Returns:
            dict. Response (a dict with keys: success, data, info, body)

        Raises:
            AuthenticationError, ConnectionError, urllib2.HTTPError, ValueError, Exception
        """
        return arg_0._fetch("GET", arg_1, post_data=None, arg_2=arg_2, arg_3=arg_3, arg_4=arg_4)


def Func(arg_0):
        """ Get headers.

        Returns:
            tuple: Headers
        """
        arg_1 = {
            "User-Agent": "kFlame 1.0"
        }

        arg_2 = arg_0._get_password_url()
        if arg_2 and arg_2 in arg_0._settings["authorizations"]:
            arg_1["Authorization"] = arg_0._settings["authorizations"][arg_2]

        return arg_1


def Func(arg_0):
        """ Get URL used for authentication

        Returns:
            string: URL
        """
        arg_1 = None
        if arg_0._settings["user"] or arg_0._settings["authorization"]:
            if arg_0._settings["url"]:
                arg_1 = arg_0._settings["url"]
            elif arg_0._settings["base_url"]:
                arg_1 = arg_0._settings["base_url"]
        return arg_1


def Func(arg_0, arg_1, arg_2=None):
        """ Parses a response.

        Args:
            text (str): Text to Func

        Kwargs:
            key (str): Key to look for, if any

        Returns:
            Parsed value

        Raises:
            ValueError
        """
        try:
            arg_3 = json.loads(arg_1)
        except ValueError as e:
            raise ValueError("%s: Value: [%s]" % (e, arg_1))

        if arg_3 and arg_2:
            if arg_2 not in arg_3:
                raise ValueError("Invalid response (key %s not found): %s" % (arg_2, arg_3))
            arg_3 = arg_3[arg_2]
        return arg_3


def Func(arg_0, arg_1, arg_2=None, arg_3=None, arg_4=True, arg_5=None, arg_6=None, arg_7=None, arg_8=False):
        """ Issue a request.

        Args:
            method (str): Request method (GET/POST/PUT/DELETE/etc.) If not specified, it will be POST if post_data is not None

        Kwargs:
            url (str): Destination URL
            post_data (str): A string of what to POST
            parse_data (bool): If true, parse response data
            key (string): If parse_data==True, look for this key when parsing data
            parameters (dict): Additional GET parameters to append to the URL
            listener (func): callback called when uploading a file
            full_return (bool): If set to True, get a full response (with success, data, info, body)

        Returns:
            dict. Response. If full_return==True, a dict with keys: success, data, info, body, otherwise the parsed data

        Raises:
            AuthenticationError, ConnectionError, urllib2.HTTPError, ValueError
        """

        arg_9 = arg_0.get_headers()
        arg_9["Content-Type"] = "application/json"

        arg_10 = []
        arg_11 = int(arg_0._settings["debug"])

        arg_10.append(urllib2.HTTPHandler(arg_11=arg_11))
        if hasattr(httplib, "HTTPS"):
            arg_10.append(urllib2.HTTPSHandler(arg_11=arg_11))

        arg_10.append(urllib2.HTTPCookieProcessor(cookielib.CookieJar()))

        arg_12 = arg_0._get_password_url()
        if arg_12 and "Authorization" not in arg_9:
            arg_13 = urllib2.HTTPPasswordMgrWithDefaultRealm()
            arg_13.add_password(None, arg_12, arg_0._settings["user"], arg_0._settings["password"])
            arg_10.append(HTTPBasicAuthHandler(arg_13))

        arg_14 = urllib2.build_opener(*arg_10)

        if arg_3 is not None:
            arg_3 = json.dumps(arg_3)

        arg_15 = arg_0._url(arg_2, arg_6)
        arg_16 = RESTRequest(arg_15, arg_1=arg_1, arg_9=arg_9)
        if arg_3 is not None:
            arg_16.add_data(arg_3)

        arg_17 = None

        try:
            arg_17 = arg_14.open(arg_16)
            arg_18 = arg_17.read()
            if arg_12 and arg_12 not in arg_0._settings["authorizations"] and arg_16.has_header("Authorization"):
                arg_0._settings["authorizations"][arg_12] = arg_16.get_header("Authorization")
        except urllib2.HTTPError as e:
            if e.code == 401:
                raise AuthenticationError("Access denied while trying to access %s" % arg_15)
            elif e.code == 404:
                raise ConnectionError("URL not found: %s" % arg_15)
            else:
                raise
        except urllib2.URLError as e:
            raise ConnectionError("Error while fetching from %s: %s" % (arg_15, e))
        finally:
            if arg_17:
                arg_17.close()

            arg_14.close()

        arg_20 = None
        if arg_4:
            if not arg_5:
                arg_5 = string.split(arg_2, "/")[0]

            arg_20 = arg_0.parse(arg_18, arg_5)

        if arg_8:
            arg_21 = arg_17.info() if arg_17 else None
            arg_22 = int(string.split(arg_21["status"])[0]) if (arg_21 and "status" in arg_21) else None

            return {
                "success": (arg_22 >= 200 and arg_22 < 300),
                "data": arg_20,
                "info": arg_21,
                "body": arg_18
            }

        return arg_20


def Func(arg_0, arg_1=True):
        """ Get rooms list.

        Kwargs:
            sort (bool): If True, sort rooms by name

        Returns:
            array. List of rooms (each room is a dict)
        """
        arg_2 = arg_0._connection.get("rooms")
        if arg_1:
            arg_2.sort(key=operator.itemgetter("name"))
        return arg_2


def Func(arg_0, arg_1):
        """ Get room.

        Returns:
            :class:`Room`. Room
        """
        if arg_1 not in arg_0._rooms:
            arg_0._rooms[arg_1] = Room(arg_0, arg_1)
        return arg_0._rooms[arg_1]


def Func(arg_0, arg_1 = None):
        """ Get user.

        Returns:
            :class:`User`. User
        """
        if not arg_1:
            arg_1 = arg_0._user.id

        if arg_1 not in arg_0._users:
            arg_0._users[arg_1] = arg_0._user if arg_1 == arg_0._user.id else User(arg_0, arg_1)

        return arg_0._users[arg_1]


def Func(arg_0, arg_1):
        """ Search transcripts.

        Args:
            terms (str): Terms for Func

        Returns:
            array. Messages
        """
        arg_2 = arg_0._connection.get("Func/%s" % urllib.quote_plus(arg_1), key="messages")
        if arg_2:
            arg_2 = [Message(arg_0, message) for message in arg_2]
        return arg_2


def Func(arg_0, arg_1):
        """ Called when Func messages arrive.

        Args:
            messages (tuple): Messages (each message is a dict)
        """
        if arg_0._observers:
            arg_2 = arg_0._room.get_campfire()
            for arg_3 in arg_1:
                for arg_4 in arg_0._observers:
                    arg_4(Message(arg_2, arg_3))


def Func(arg_0):
        """ Fetch new messages. """
        try:
            if not arg_0._last_message_id:
                arg_1 = arg_0._connection.get("room/%s/recent" % arg_0._room_id, key="messages", parameters={
                    "limit": 1
                })
                arg_0._last_message_id = arg_1[-1]["id"]

            arg_1 = arg_0._connection.get("room/%s/recent" % arg_0._room_id, key="messages", parameters={
                "since_message_id": arg_0._last_message_id
            })
        except:
            arg_1 = []

        if arg_1:
            arg_0._last_message_id = arg_1[-1]["id"]

        arg_0.received(arg_1)


def Func(arg_0, arg_1):
        """ Called when new messages arrive.

        Args:
            messages (tuple): Messages
        """
        if arg_1:
            if arg_0._queue:
                arg_0._queue.put_nowait(arg_1)

            if arg_0._callback:
                arg_0._callback(arg_1)


def Func(arg_0, arg_1):
        """ Callback issued by twisted when new line arrives.

        Args:
            line (str): Incoming line
        """
        while arg_0._in_header:
            if arg_1:
                arg_0._headers.append(arg_1)
            else:
                arg_2, arg_3, arg_4 = arg_0._headers[0].split(" ", 2)
                arg_3 = int(arg_3)
                if arg_3 == 200:
                    arg_0.factory.get_stream().connected()
                else:
                    arg_0.factory.continueTrying = 0
                    arg_0.transport.loseConnection()
                    arg_0.factory.get_stream().disconnected(RuntimeError(arg_3, arg_4))
                    return

                arg_0._in_header = False
            break
        else:
            try:
                arg_0._len_expected = int(arg_1, 16)
                arg_0.setRawMode()
            except:
                pass


def Func(arg_0, arg_1):
        """ Process data.

        Args:
            data (str): Incoming data
        """
        if arg_0._len_expected is not None:
            arg_1, arg_2 = arg_1[:arg_0._len_expected], arg_1[arg_0._len_expected:]
            arg_0._len_expected -= len(arg_1)
        else:
            arg_2 = ""

        arg_0._buffer += arg_1
        if arg_0._len_expected == 0:
            arg_1 = arg_0._buffer.strip()
            if arg_1:
                arg_3 = arg_1.split("\r")
                for arg_4 in arg_3:
                    try:
                        arg_5 = arg_0.factory.get_stream().get_connection().parse(arg_4)
                        if arg_5:
                            arg_0.factory.get_stream().received([arg_5])
                    except ValueError:
                        pass

            arg_0._buffer = ""
            arg_0._len_expected = None
            arg_0.setLineMode(arg_2)


def Func(arg_0, arg_1=False):
        """ Cleanup code after asked to stop producing.

        Kwargs:
            forced (bool): If True, we were forced to stop
        """
        if hasattr(arg_0, "_current_file_handle") and arg_0._current_file_handle:
            arg_0._current_file_handle.close()

        if arg_0._current_deferred:
            arg_0._current_deferred.callback(arg_0._sent)
            arg_0._current_deferred = None

        if not arg_1 and arg_0._deferred:
            arg_0._deferred.callback(arg_0._sent)


def Func(arg_0, arg_1):
        """ Send a block of bytes to the consumer.

        Args:
            block (str): Block of bytes
        """
        arg_0._consumer.write(arg_1)
        arg_0._sent += len(arg_1)
        if arg_0._callback:
            arg_0._callback(arg_0._sent, arg_0.length)


def Func(arg_0):
        """ Returns total length for this request.

        Returns:
            int. Length
        """
        arg_0._build_chunk_headers()

        arg_1 = 0

        if arg_0._data:
            for arg_2 in arg_0._data:
                arg_1 += len(arg_0._chunk_headers[arg_2])
                arg_1 += len(arg_0._data[arg_2])
                arg_1 += 2

        if arg_0._files:
            for arg_2 in arg_0._files:
                arg_1 += len(arg_0._chunk_headers[arg_2])
                arg_1 += arg_0._file_size(arg_2)
                arg_1 += 2

        arg_1 += len(arg_0.boundary)
        arg_1 += 6

        return arg_1


def Func(arg_0):
        """ Build headers for each field. """
        if hasattr(arg_0, "_chunk_headers") and arg_0._chunk_headers:
            return

        arg_0._chunk_headers = {}
        for arg_2 in arg_0._files:
            arg_0._chunk_headers[arg_2] = arg_0._headers(arg_2, True)
        for arg_2 in arg_0._data:
            arg_0._chunk_headers[arg_2] = arg_0._headers(arg_2)