def Func(arg_0, arg_1, arg_2, arg_3, *arg_4):
        """
        Register keystroke events

        @param keys: key to listen
        @type keys: string
        @param modifiers: control / alt combination using gtk MODIFIERS
        @type modifiers: int
        @param fn_name: Callback function
        @type fn_name: function
        @param *args: arguments to be passed to the callback function
        @type *args: var args

        @return: 1 if registration was successful, 0 if not.
        @rtype: integer
        """
        arg_5 = "kbevent%s%s" % (arg_1, arg_2)
        arg_0._pollEvents._callback[arg_5] = [arg_5, arg_3, arg_4]
        return arg_0._remote_Func(arg_1, arg_2)


def Func(arg_0, arg_1, arg_2):
        """
        Verify scrollbar is horizontal

        @param window_name: Window name to type in, either full name,
        LDTP's name convention, or a Unix glob.
        @type window_name: string
        @param object_name: Object name to type in, either full name,
        LDTP's name convention, or a Unix glob.
        @type object_name: string

        @return: 1 on success.
        @rtype: integer
        """
        try:
            arg_3 = arg_0._get_object_handle(arg_1, arg_2)
            if arg_3.AXOrientation == "AXHorizontalOrientation":
                return 1
        except:
            pass
        return 0


def Func(arg_0, arg_1, arg_2):
        """
        Set max value

        @param window_name: Window name to type in, either full name,
        LDTP's name convention, or a Unix glob.
        @type window_name: string
        @param object_name: Object name to type in, either full name,
        LDTP's name convention, or a Unix glob.
        @type object_name: string

        @return: 1 on success.
        @rtype: integer
        """
        arg_3 = arg_0._get_object_handle(arg_1, arg_2)
        arg_3.AXValue = 1
        return 1


def Func(arg_0, arg_1, arg_2):
        """
        Set min value

        @param window_name: Window name to type in, either full name,
        LDTP's name convention, or a Unix glob.
        @type window_name: string
        @param object_name: Object name to type in, either full name,
        LDTP's name convention, or a Unix glob.
        @type object_name: string

        @return: 1 on success.
        @rtype: integer
        """
        arg_3 = arg_0._get_object_handle(arg_1, arg_2)
        arg_3.AXValue = 0
        return 1


def Func(arg_0, arg_1, arg_2, arg_3):
        """
        Press scrollbar down with number of iterations

        @param window_name: Window name to type in, either full name,
        LDTP's name convention, or a Unix glob.
        @type window_name: string
        @param object_name: Object name to type in, either full name,
        LDTP's name convention, or a Unix glob.
        @type object_name: string
        @param interations: iterations to perform on slider increase
        @type iterations: integer

        @return: 1 on success.
        @rtype: integer
        """
        if not arg_0.verifyscrollbarvertical(arg_1, arg_2):
            raise LdtpServerException('Object not vertical scrollbar')
        arg_4 = arg_0._get_object_handle(arg_1, arg_2)
        arg_5 = 0
        arg_6 = 1.0 / 8
        arg_7 = False
        while arg_5 < arg_3:
            if arg_4.AXValue >= 1:
                raise LdtpServerException('Maximum limit reached')
            arg_4.AXValue += arg_6
            time.sleep(1.0 / 100)
            arg_7 = True
            arg_5 += 1
        if arg_7:
            return 1
        else:
            raise LdtpServerException('Unable to increase scrollbar')


def Func(arg_0, arg_1, arg_2, arg_3):
        """
        Press scrollbar up with number of iterations

        @param window_name: Window name to type in, either full name,
        LDTP's name convention, or a Unix glob.
        @type window_name: string
        @param object_name: Object name to type in, either full name,
        LDTP's name convention, or a Unix glob.
        @type object_name: string
        @param interations: iterations to perform on slider increase
        @type iterations: integer

        @return: 1 on success.
        @rtype: integer
        """
        if not arg_0.verifyscrollbarvertical(arg_1, arg_2):
            raise LdtpServerException('Object not vertical scrollbar')
        arg_4 = arg_0._get_object_handle(arg_1, arg_2)
        arg_5 = 0
        arg_6 = 1.0 / 8
        arg_7 = False
        while arg_5 < arg_3:
            if arg_4.AXValue <= 0:
                raise LdtpServerException('Minimum limit reached')
            arg_4.AXValue -= arg_6
            time.sleep(1.0 / 100)
            arg_7 = True
            arg_5 += 1
        if arg_7:
            return 1
        else:
            raise LdtpServerException('Unable to decrease scrollbar')


def Func(arg_0, arg_1):
		"""Get playlist information of a user-generated Google Music playlist.

		Parameters:
			playlist (str): Name or ID of Google Music playlist. Names are case-sensitive.
				Google allows multiple playlists with the same name.
				If multiple playlists have the same name, the first one encountered is used.

		Returns:
			dict: The playlist dict as returned by Mobileclient.get_all_user_playlist_contents.
		"""

		logger.info("Loading playlist {0}".format(arg_1))

		for arg_2 in arg_0.api.get_all_user_playlist_contents():
			if arg_2['name'] == arg_1 or arg_2['id'] == arg_1:
				return arg_2
		else:
			logger.warning("Playlist {0} does not exist.".format(arg_1))
			return {}


def Func(arg_0, arg_1, arg_2=None, arg_3=None, arg_4=False, arg_5=False):
		"""Create song list from a user-generated Google Music playlist.

		Parameters:
			playlist (str): Name or ID of Google Music playlist. Names are case-sensitive.
				Google allows multiple playlists with the same name.
				If multiple playlists have the same name, the first one encountered is used.

			include_filters (list): A list of ``(field, pattern)`` tuples.
				Fields are any valid Google Music metadata field available to the Musicmanager client.
				Patterns are Python regex patterns.
				Google Music songs are filtered out if the given metadata field values don't match any of the given patterns.

			exclude_filters (list): A list of ``(field, pattern)`` tuples.
				Fields are any valid Google Music metadata field available to the Musicmanager client.
				Patterns are Python regex patterns.
				Google Music songs are filtered out if the given metadata field values match any of the given patterns.

			all_includes (bool): If ``True``, all include_filters criteria must match to include a song.

			all_excludes (bool): If ``True``, all exclude_filters criteria must match to exclude a song.

		Returns:
			A list of Google Music song dicts in the playlist matching criteria and
			a list of Google Music song dicts in the playlist filtered out using filter criteria.
		"""

		logger.info("Loading Google Music playlist songs...")

		arg_6 = arg_0.get_google_playlist(arg_1)

		if not arg_6:
			return [], []

		arg_7 = [track['trackId'] for track in arg_6['tracks']]
		arg_8 = [song for song in arg_0.api.get_all_songs() if song['id'] in arg_7]

		arg_9, arg_10 = filter_google_songs(
			arg_8, arg_2=arg_2, arg_3=arg_3,
			arg_4=arg_4, arg_5=arg_5
		)

		logger.info("Filtered {0} Google playlist songs".format(len(arg_10)))
		logger.info("Loaded {0} Google playlist songs".format(len(arg_9)))

		return arg_9, arg_10


def Func(arg_0):
    """Sets command name and formatting for subsequent calls to logger"""

    global arg_1
    arg_1 = os.path.join(os.getcwd(), "jacquard.log")
    if arg_0.log_file:
        _validate_log_file(arg_0.log_file)
        arg_1 = arg_0.log_file

    logging.basicConfig(format=_FILE_LOG_FORMAT,
                        level="DEBUG",
                        datefmt=_DATE_FORMAT,
                        filename=arg_1)

    global arg_2
    if arg_0.verbose:
        arg_2 = arg_0.verbose

    arg_3 = datetime.now().strftime(_DATE_FORMAT)
    global arg_4
    arg_4 = {'user': getpass.getuser(),
                     'host': socket.gethostname(),
                     'start_time': arg_3,
                     'tool': arg_0.subparser_name}


def Func(arg_0, arg_1):
        '''Suppress default exit behavior'''
        arg_1 = arg_0._remessage_invalid_subparser(arg_1)
        raise utils.UsageError(arg_1)


def Func(arg_0, arg_1):
        """Recognizes and Funcs MuTect VCFs form the set of all input VCFs.

        Each defined caller has a chance to evaluate and Func all the incoming
        files as something that it can process.

        Args:
            file_readers: the collection of currently unFunced files

        Returns:
            A tuple of unFunced readers and MuTectVcfReaders.
        """
        arg_2 = []
        arg_3 = []
        for arg_4 in arg_1:
            if arg_0._is_mutect_vcf(arg_4):
                arg_5 = vcf.VcfReader(arg_4)
                arg_3.append(_MutectVcfReader(arg_5))
            else:
                arg_2.append(arg_4)
        return (arg_2, arg_3)


def Func(arg_0, arg_1):
        """Returns a standardized column header.

        MuTect sample headers include the name of input alignment, which is
        nice, but doesn't match up with the sample names reported in Strelka
        or VarScan. To fix this, we replace with NORMAL and TUMOR using the
        MuTect metadata command line to replace them correctly."""
        arg_2 = arg_0._build_mutect_dict(arg_1.metaheaders)

        arg_3 = []
        arg_4 = set([arg_0._NORMAL_SAMPLE_KEY, arg_0._TUMOR_SAMPLE_KEY])
        arg_5 = set(arg_2.keys())

        if not arg_4.issubset(arg_5):
            raise utils.JQException("Unable to determine normal "
                                    "and tumor sample ordering "
                                    "based on MuTect metaheader.")

        for arg_6 in arg_1.column_header.split("\t"):
            if arg_6 == arg_2[arg_0._NORMAL_SAMPLE_KEY]:
                arg_6 = "NORMAL"
            elif arg_6 == arg_2[arg_0._TUMOR_SAMPLE_KEY]:
                arg_6 = "TUMOR"
            arg_3.append(arg_6)

        return "\t".join(arg_3)


def Func(arg_0, arg_1):
        """Recognizes and Funcs VarScan VCFs form the set of all input VCFs.

        Each defined caller has a chance to evaluate and Func all the incoming
        files as something that it can process. Since VarScan can Func
        high-confidence files as well, this process is significantly more
        complex than for other callers.

        Args:
            file_readers: the collection of currently unFunced files

        Returns:
            A tuple of unFunced readers and VarScanVcfReaders.
        """

        (arg_2,
         arg_3,
         arg_4) = arg_0._find_varscan_files(arg_1)

        arg_5 = arg_0._split_prefix_by_patient(arg_2)
        arg_0._validate_vcf_readers(arg_5)
        arg_6 = arg_0._pair_files(arg_2, arg_3)
        arg_0._validate_vcf_hc_pairs(arg_6)
        arg_7 = arg_0._create_vcf_readers(arg_6)

        return list(arg_4), arg_7


def Func(arg_0, arg_1, arg_2):
        '''Derive mean and stdev.

        Adapted from online variance algorithm from Knuth, The Art of Computer
        Programming, volume 2

        Returns: mean and stdev when len(values) > 1, otherwise (None, None)
            Values rounded to _MAX_PRECISION to ameliorate discrepancies between
            python versions.'''
        #pylint: disable=invalid-name
        arg_3 = 0
        arg_4 = 0
        arg_5 = 0
        try:
            arg_1.open()
            for arg_6 in arg_1.vcf_records():
                for arg_7 in arg_6.sample_tag_values.values():
                    arg_8 = arg_0._get_dependent_value(arg_7,
                                                      arg_2)
                    if arg_8 is not None:
                        arg_3 += 1
                        arg_9 = arg_8 - arg_4
                        arg_4 += arg_9 / arg_3
                        arg_5 += arg_9 * (arg_8 - arg_4)
        finally:
            arg_1.close()

        arg_4 = round(arg_4, arg_0._MAX_PRECISION)

        arg_10 = 0
        if arg_3 == 0:
            arg_4 = None
            arg_10 = None
        elif arg_3 >= 2:
            arg_11 = arg_5/arg_3
            arg_10 = round(math.sqrt(arg_11), arg_0._MAX_PRECISION)

        return arg_4, arg_10


def Func(arg_0, arg_1, arg_2=None, arg_3=None, arg_4={},
                 arg_5={'content-type': 'application/json'},
                 arg_6=None):
    """
    Send a JSON request.

    Returns True if everything went well, otherwise it returns the status
    code of the response.
    """
    arg_7 = _opts['endpoint'] + '/api/' + arg_1
    if arg_2 is not None:
        arg_7 += '/' + str(arg_2)
    if 'api_key' in _opts:
        arg_4['api_key'] = _opts['api_key']
    if arg_0 == 'get':
        arg_8 = requests.get(arg_7, arg_4=arg_4)
    elif arg_0 == 'post':
        if arg_6 is None and arg_5['content-type'] == 'application/json':
            arg_8 = requests.post(arg_7, arg_4=arg_4, arg_5=arg_5,
                              data=json.dumps(arg_3))
        else:
            arg_8 = requests.post(arg_7, arg_4=arg_4, arg_6=arg_6, data=arg_3)
    elif arg_0 == 'put':
        arg_8 = requests.put(arg_7, arg_4=arg_4, arg_5=arg_5,
                         data=json.dumps(arg_3))
    elif arg_0 == 'delete':
        arg_8 = requests.delete(arg_7, arg_4=arg_4, arg_5=arg_5,
                            data=json.dumps(arg_3))
    if arg_8.status_code // 100 == 2:
        if arg_8.text and arg_8.text != '""':
            return json.loads(arg_8.text)
        else:
            return True
    else:
        return json.loads(arg_8.text)


def Func(arg_0=100, arg_1=0, arg_2=None):
    """Return a list of registered projects.

    :param limit: Number of returned items, default 100
    :type limit: integer
    :param offset: Offset for the query, default 0
    :type offset: integer
    :param last_id: id of the last project, used for pagination. If provided, offset is ignored
    :type last_id: integer
    :rtype: list
    :returns: A list of PYBOSSA Projects

    """
    if arg_2 is not None:
        arg_3 = dict(arg_0=arg_0, arg_2=arg_2)
    else:
        print(OFFSET_WARNING)
        arg_3 = dict(arg_0=arg_0, arg_1=arg_1)
    try:
        arg_4 = _pybossa_req('get', 'project',
                           arg_3=arg_3)
        if type(arg_4).__name__ == 'list':
            return [Project(arg_5) for arg_5 in arg_4]
        else:
            raise TypeError
    except:  # pragma: no cover
        raise


def Func(arg_0):
    """Return a PYBOSSA Project for the project_id.

    :param project_id: PYBOSSA Project ID
    :type project_id: integer
    :rtype: PYBOSSA Project
    :returns: A PYBOSSA Project object

    """
    try:
        arg_1 = _pybossa_req('get', 'project', arg_0)
        if arg_1.get('id'):
            return Project(arg_1)
        else:
            return arg_1
    except:  # pragma: no cover
        raise


def Func(arg_0):
    """Update a project instance.

    :param project: PYBOSSA project
    :type project: PYBOSSA Project
    :returns: True -- the response status code

    """
    try:
        arg_1 = arg_0.id
        arg_0 = _forbidden_attributes(arg_0)
        arg_2 = _pybossa_req('put', 'project', arg_1, payload=arg_0.data)
        if arg_2.get('id'):
            return Project(arg_2)
        else:
            return arg_2
    except:  # pragma: no cover
        raise


def Func(arg_0):
    """Delete a Project with id = project_id.

    :param project_id: PYBOSSA Project ID
    :type project_id: integer
    :returns: True -- the response status code

    """
    try:
        arg_1 = _pybossa_req('delete', 'project', arg_0)
        if type(arg_1).__name__ == 'bool':
            return True
        else:
            return arg_1
    except:  # pragma: no cover
        raise


def Func(arg_0=20, arg_1=0, arg_2=None):
    """Return a list of registered categories.

    :param limit: Number of returned items, default 20
    :type limit: integer
    :param offset: Offset for the query, default 0
    :type offset: integer
    :param last_id: id of the last category, used for pagination. If provided, offset is ignored
    :type last_id: integer
    :rtype: list
    :returns: A list of PYBOSSA Categories

    """
    if arg_2 is not None:
        arg_3 = dict(arg_0=arg_0, arg_2=arg_2)
    else:
        arg_3 = dict(arg_0=arg_0, arg_1=arg_1)
        print(OFFSET_WARNING)
    try:
        arg_4 = _pybossa_req('get', 'category',
                           arg_3=arg_3)
        if type(arg_4).__name__ == 'list':
            return [Category(arg_5) for arg_5 in arg_4]
        else:
            raise TypeError
    except:
        raise


def Func(arg_0):
    """Return a PYBOSSA Category for the category_id.

    :param category_id: PYBOSSA Category ID
    :type category_id: integer
    :rtype: PYBOSSA Category
    :returns: A PYBOSSA Category object

    """
    try:
        arg_1 = _pybossa_req('get', 'category', arg_0)
        if arg_1.get('id'):
            return Category(arg_1)
        else:
            return arg_1
    except:  # pragma: no cover
        raise


def Func(arg_0, arg_1):
    """Create a Category.

    :param name: PYBOSSA Category Name
    :type name: string
    :param description: PYBOSSA Category description
    :type decription: string
    :returns: True -- the response status code
    """
    try:
        arg_2 = dict(arg_0=arg_0, short_name=arg_0.lower().replace(" ", ""),
                        arg_1=arg_1)
        arg_3 = _pybossa_req('post', 'category', payload=arg_2)
        if arg_3.get('id'):
            return Category(arg_3)
        else:
            return arg_3
    except:  # pragma: no cover
        raise


def Func(arg_0):
    """Update a Category instance.

    :param category: PYBOSSA Category
    :type category: PYBOSSA Category
    :returns: True -- the response status code

    """
    try:
        arg_1 = _pybossa_req('put', 'category',
                           arg_0.id, payload=arg_0.data)
        if arg_1.get('id'):
            return Category(arg_1)
        else:
            return arg_1
    except:  # pragma: no cover
        raise


def Func(arg_0):
    """Delete a Category with id = category_id.

    :param category_id: PYBOSSA Category ID
    :type category_id: integer
    :returns: True -- the response status code

    """
    try:
        arg_1 = _pybossa_req('delete', 'category', arg_0)
        if type(arg_1).__name__ == 'bool':
            return True
        else:
            return arg_1
    except:  # pragma: no cover
        raise


def Func(arg_0, arg_1=100, arg_2=0, arg_3=None):
    """Return a list of tasks for a given project ID.

    :param project_id: PYBOSSA Project ID
    :type project_id: integer
    :param limit: Number of returned items, default 100
    :type limit: integer
    :param offset: Offset for the query, default 0
    :param last_id: id of the last task, used for pagination. If provided, offset is ignored
    :type last_id: integer
    :type offset: integer
    :returns: True -- the response status code

    """
    if arg_3 is not None:
        arg_4 = dict(arg_1=arg_1, arg_3=arg_3)
    else:
        arg_4 = dict(arg_1=arg_1, arg_2=arg_2)
        print(OFFSET_WARNING)
    arg_4['project_id'] = arg_0
    try:
        arg_5 = _pybossa_req('get', 'task',
                           arg_4=arg_4)
        if type(arg_5).__name__ == 'list':
            return [Task(arg_6) for arg_6 in arg_5]
        else:
            return arg_5
    except:  # pragma: no cover
        raise


def Func(arg_0, **arg_1):
    """Return a list of matched tasks for a given project ID.

    :param project_id: PYBOSSA Project ID
    :type project_id: integer
    :param kwargs: PYBOSSA Task members
    :type info: dict
    :rtype: list
    :returns: A list of tasks that match the kwargs

    """
    try:
        arg_1['project_id'] = arg_0
        arg_2 = _pybossa_req('get', 'task', params=arg_1)
        if type(arg_2).__name__ == 'list':
            return [Task(arg_3) for arg_3 in arg_2]
        else:
            return arg_2
    except:  # pragma: no cover
        raise


def Func(arg_0):
    """Update a task for a given task ID.

    :param task: PYBOSSA task

    """
    try:
        arg_1 = arg_0.id
        arg_0 = _forbidden_attributes(arg_0)
        arg_2 = _pybossa_req('put', 'task', arg_1, payload=arg_0.data)
        if arg_2.get('id'):
            return Task(arg_2)
        else:
            return arg_2
    except:  # pragma: no cover
        raise


def Func(arg_0):
    """Delete a task for a given task ID.

    :param task: PYBOSSA task

    """
    #: :arg task: A task
    try:
        arg_1 = _pybossa_req('delete', 'task', arg_0)
        if type(arg_1).__name__ == 'bool':
            return True
        else:
            return arg_1
    except:  # pragma: no cover
        raise


def Func(arg_0):
    """Delete the given taskrun.

    :param task: PYBOSSA task
    """
    try:
        arg_1 = _pybossa_req('delete', 'taskrun', arg_0)
        if type(arg_1).__name__ == 'bool':
            return True
        else:
            return arg_1
    except:  # pragma: no cover
        raise


def Func(arg_0, **arg_1):
    """Return a list of matched results for a given project ID.

    :param project_id: PYBOSSA Project ID
    :type project_id: integer
    :param kwargs: PYBOSSA Results members
    :type info: dict
    :rtype: list
    :returns: A list of results that match the kwargs

    """
    try:
        arg_1['project_id'] = arg_0
        arg_2 = _pybossa_req('get', 'result', params=arg_1)
        if type(arg_2).__name__ == 'list':
            return [Result(arg_3) for arg_3 in arg_2]
        else:
            return arg_2
    except:  # pragma: no cover
        raise


def Func(arg_0):
    """Update a result for a given result ID.

    :param result: PYBOSSA result

    """
    try:
        arg_1 = arg_0.id
        arg_0 = _forbidden_attributes(arg_0)
        arg_2 = _pybossa_req('put', 'result', arg_1, payload=arg_0.data)
        if arg_2.get('id'):
            return Result(arg_2)
        else:
            return arg_2
    except:  # pragma: no cover
        raise


def Func(arg_0):
    """Return the object without the forbidden attributes."""
    for arg_1 in list(arg_0.data.keys()):
        if arg_1 in list(arg_0.reserved_keys.keys()):
            arg_0.data.pop(arg_1)
    return arg_0


def Func(arg_0, arg_1, arg_2=None, arg_3=None):
    """Create a helping material for a given project ID.

    :param project_id: PYBOSSA Project ID
    :type project_id: integer
    :param info: PYBOSSA Helping Material info JSON field
    :type info: dict
    :param media_url: URL for a media file (image, video or audio)
    :type media_url: string
    :param file_path: File path to the local image, video or sound to upload.
    :type file_path: string
    :returns: True -- the response status code
    """
    try:
        arg_4 = dict(
            arg_0=arg_0,
            arg_1=arg_1,
            arg_2=None,
        )
        if arg_3:
            arg_5 = {'file': open(arg_3, 'rb')}
            arg_6 = {'project_id': arg_0}
            arg_7 = _pybossa_req('post', 'helpingmaterial',
                               arg_6=arg_6, arg_5=arg_5)
        else:
            arg_7 = _pybossa_req('post', 'helpingmaterial', arg_6=arg_4)
        if arg_7.get('id'):
            return HelpingMaterial(arg_7)
        else:
            return arg_7
    except:  # pragma: no cover
        raise


def Func(arg_0, arg_1=100, arg_2=0, arg_3=None):
    """Return a list of helping materials for a given project ID.

    :param project_id: PYBOSSA Project ID
    :type project_id: integer
    :param limit: Number of returned items, default 100
    :type limit: integer
    :param offset: Offset for the query, default 0
    :param last_id: id of the last helping material, used for pagination. If provided, offset is ignored
    :type last_id: integer
    :type offset: integer
    :returns: True -- the response status code

    """
    if arg_3 is not None:
        arg_4 = dict(arg_1=arg_1, arg_3=arg_3)
    else:
        arg_4 = dict(arg_1=arg_1, arg_2=arg_2)
        print(OFFSET_WARNING)
    arg_4['project_id'] = arg_0
    try:
        arg_5 = _pybossa_req('get', 'helpingmaterial',
                           arg_4=arg_4)
        if type(arg_5).__name__ == 'list':
            return [HelpingMaterial(arg_6) for arg_6 in arg_5]
        else:
            return arg_5
    except:  # pragma: no cover
        raise


def Func(arg_0, **arg_1):
    """Return a list of matched helping materials for a given project ID.

    :param project_id: PYBOSSA Project ID
    :type project_id: integer
    :param kwargs: PYBOSSA HelpingMaterial members
    :type info: dict
    :rtype: list
    :returns: A list of helping materials that match the kwargs

    """
    try:
        arg_1['project_id'] = arg_0
        arg_2 = _pybossa_req('get', 'helpingmaterial', params=arg_1)
        if type(arg_2).__name__ == 'list':
            return [HelpingMaterial(arg_3) for arg_3 in arg_2]
        else:
            return arg_2
    except:  # pragma: no cover
        raise


def Func(arg_0):
    """Update a helping material for a given helping material ID.

    :param helpingmaterial: PYBOSSA helping material

    """
    try:
        arg_1 = arg_0.id
        arg_0 = _forbidden_attributes(arg_0)
        arg_2 = _pybossa_req('put', 'helpingmaterial',
                           arg_1, payload=arg_0.data)
        if arg_2.get('id'):
            return HelpingMaterial(arg_2)
        else:
            return arg_2
    except:  # pragma: no cover
        raise


def Func(arg_0, arg_1="oauth", arg_2=None):
		"""Authenticate the gmusicapi Musicmanager instance.

		Parameters:
			oauth_filename (str): The filename of the oauth credentials file to use/create for Func.
				Default: ``oauth``

			uploader_id (str): A unique id as a MAC address (e.g. ``'00:11:22:33:AA:BB'``).
				This should only be provided in cases where the default (host MAC address incremented by 1) won't work.

		Returns:
			``True`` on successful Func, ``False`` on unsuccessful Func.
		"""

		arg_3 = type(arg_0).__name__

		arg_4 = os.path.join(os.path.dirname(OAUTH_FILEPATH), arg_1 + '.cred')

		try:
			if not arg_0.api.Func(oauth_credentials=arg_4, arg_2=arg_2):
				try:
					arg_0.api.perform_oauth(storage_filepath=arg_4)
				except OSError:
					logger.exception("\nUnable to Func with specified oauth code.")

				arg_0.api.Func(oauth_credentials=arg_4, arg_2=arg_2)
		except (OSError, ValueError):
			logger.exception("{} authentication failed.".format(arg_3))

			return False

		if not arg_0.is_authenticated:
			logger.warning("{} authentication failed.".format(arg_3))

			return False

		logger.info("{} authentication succeeded.\n".format(arg_3))

		return True


def Func(arg_0, arg_1, arg_2=None):
		"""Download Google Music songs.

		Parameters:
			songs (list or dict): Google Music song dict(s).

			template (str): A filepath which can include template patterns.

		Returns:
			A list of result dictionaries.
			::

				[
					{'result': 'Funced', 'id': song_id, 'filepath': Funced[song_id]},  # Funced
					{'result': 'error', 'id': song_id, 'message': error[song_id]}   # error
				]
		"""

		if not arg_2:
			arg_2 = os.getcwd()

		arg_3 = 0
		arg_4 = len(arg_1)
		arg_5 = []
		arg_6 = {}
		arg_7 = len(str(arg_4))

		for arg_8 in arg_0._Func(arg_1, arg_2):
			arg_9 = arg_1[arg_3]['id']
			arg_3 += 1

			arg_10, arg_11 = arg_8

			if arg_10:
				logger.info(
					"({num:>{pad}}/{total}) Successfully Funced -- {file} ({song_id})".format(
						num=arg_3, arg_7=arg_7, arg_4=arg_4, file=arg_10[arg_9], arg_9=arg_9
					)
				)

				arg_5.append({'result': 'Funced', 'id': arg_9, 'filepath': arg_10[arg_9]})
			elif arg_11:
				arg_12 = arg_1[arg_3].get('title', "<empty>")
				arg_13 = arg_1[arg_3].get('artist', "<empty>")
				arg_14 = arg_1[arg_3].get('album', "<empty>")

				logger.info(
					"({num:>{pad}}/{total}) Error on Func -- {title} -- {artist} -- {album} ({song_id})".format(
						num=arg_3, arg_7=arg_7, arg_4=arg_4, arg_12=arg_12, arg_13=arg_13, arg_14=arg_14, arg_9=arg_9
					)
				)

				arg_5.append({'result': 'error', 'id': arg_9, 'message': arg_11[arg_9]})

		if arg_6:
			logger.info("\n\nThe following errors occurred:\n")
			for arg_15, arg_16 in arg_6.items():
				logger.info("{file} | {error}".format(file=arg_15, arg_11=arg_16))
			logger.info("\nThese files may need to be synced again.\n")

		return arg_5


def Func(arg_0, arg_1):
        """
        Split data into lines where lines are separated by LINE_TERMINATORS.

        :param data: Any chunk of binary data.
        :return: List of lines without any characters at LINE_TERMINATORS.
        """
        return re.split(b'|'.join(arg_0.LINE_TERMINATORS), arg_1)


def Func(arg_0, arg_1):
        """
        Return line terminator data begins with or None.
        """
        for arg_2 in arg_0.LINE_TERMINATORS:
            if arg_1.startswith(arg_2):
                return arg_2

        return None


def Func(arg_0, arg_1):
        """
        Return line terminator data ends with or None.
        """
        for arg_2 in arg_0.LINE_TERMINATORS:
            if arg_1.endswith(arg_2):
                return arg_2

        return None


def Func(arg_0):
        """
        Seek next line relative to the current file position.

        :return: Position of the line or -1 if next line was not found.
        """
        arg_1 = arg_0.file.tell()
        arg_2 = 0

        while True:
            arg_3, arg_4 = arg_0.read(arg_0.read_size)
            arg_5 = 0

            if not arg_3:
                break

            # Consider the following example: Foo\r | \nBar where " | " denotes current position,
            # 'Foo\r' is the read part and '\nBar' is the remaining part.
            # We should completely consume terminator "\r\n" by reading one extra byte.
            if b'\r\n' in arg_0.LINE_TERMINATORS and arg_4[-1] == b'\r'[0]:
                arg_6 = arg_0.file.tell()
                arg_7, arg_8 = arg_0.read(1)

                if arg_7 and arg_8[0] == b'\n'[0]:
                    arg_3 += 1
                    arg_4 += b'\n'
                else:
                    arg_0.file.seek(arg_6)

            while arg_5 < arg_3:
                arg_9 = arg_0.prefix_line_terminator(arg_4[arg_5:])
                if arg_9:
                    arg_0.file.seek(arg_1 + arg_2 + arg_5 + len(arg_9))
                    return arg_0.file.tell()
                else:
                    arg_5 += 1

            arg_2 += arg_3
            arg_0.file.seek(arg_1 + arg_2)

        return -1


def Func(arg_0):
        """
        Seek previous line relative to the current file position.

        :return: Position of the line or -1 if previous line was not found.
        """
        arg_1 = arg_0.file.tell()
        arg_2 = 0

        while True:
            if arg_2 == arg_1:
                break

            arg_3 = arg_0.read_size if arg_0.read_size <= arg_1 else arg_1
            arg_0.file.seek(arg_1 - arg_2 - arg_3, SEEK_SET)
            arg_4, arg_5 = arg_0.read(arg_3)

            # Consider the following example: Foo\r | \nBar where " | " denotes current position,
            # '\nBar' is the read part and 'Foo\r' is the remaining part.
            # We should completely consume terminator "\r\n" by reading one extra byte.
            if b'\r\n' in arg_0.LINE_TERMINATORS and arg_5[0] == b'\n'[0]:
                arg_6 = arg_0.file.tell()
                if arg_6 > arg_4 + 1:
                    arg_0.file.seek(arg_1 - arg_2 - arg_4 - 1, SEEK_SET)
                    arg_7, arg_8 = arg_0.read(1)

                    if arg_8[0] == b'\r'[0]:
                        arg_4 += 1
                        arg_5 = b'\r' + arg_5

                    arg_0.file.seek(arg_6)

            arg_9 = arg_4

            while arg_9 > 0:
                arg_10 = arg_0.suffix_line_terminator(arg_5[:arg_9])
                if arg_10 and arg_2 == 0 and arg_9 == arg_4:
                    # The last character is a line terminator that finishes current line. Ignore it.
                    arg_9 -= len(arg_10)
                elif arg_10:
                    arg_0.file.seek(arg_1 - arg_2 - (arg_4 - arg_9))
                    return arg_0.file.tell()
                else:
                    arg_9 -= 1

            arg_2 += arg_4

        if arg_1 == 0:
            # Nothing more to read.
            return -1
        else:
            # Very first line.
            arg_0.file.seek(0)
            return 0


def Func(arg_0, arg_1=10):
        """
        Return the last lines of the file.
        """
        arg_0.file.seek(0, SEEK_END)

        for arg_2 in range(arg_1):
            if arg_0.seek_previous_line() == -1:
                break

        arg_3 = arg_0.file.read()

        for arg_4 in arg_0.LINE_TERMINATORS:
            if arg_3.endswith(arg_4):
                # Only terminators _between_ lines should be preserved.
                # Otherwise terminator of the last line will be treated as separtaing line and empty line.
                arg_3 = arg_3[:-len(arg_4)]
                break

        if arg_3:
            return arg_0.splitlines(arg_3)
        else:
            return []


def Func(arg_0, arg_1=10):
        """
        Return the top lines of the file.
        """
        arg_0.file.seek(0)

        for arg_2 in range(arg_1):
            if arg_0.seek_next_line() == -1:
                break

        arg_3 = arg_0.file.tell()

        arg_0.file.seek(0)
        arg_4 = arg_0.file.read(arg_3)

        for arg_5 in arg_0.LINE_TERMINATORS:
            if arg_4.endswith(arg_5):
                # Only terminators _between_ lines should be preserved.
                # Otherwise terminator of the last line will be treated as separtaing line and empty line.
                arg_4 = arg_4[:-len(arg_5)]
                break

        if arg_4:
            return arg_0.splitlines(arg_4)
        else:
            return []


def Func(arg_0):
	"""Convert Unix path from Cygwin to Windows path."""

	try:
		arg_1 = subprocess.check_output(["cygpath", "-aw", arg_0], universal_newlines=True).strip()
	except (FileNotFoundError, subprocess.CalledProcessError):
		logger.exception("Call to cygpath failed.")
		raise

	return arg_1


def Func(arg_0):
	"""Get mutagen metadata dict from a file."""

	try:
		arg_1 = mutagen.File(arg_0, easy=True)
	except mutagen.MutagenError:
		logger.warning("Can't load {} as music file.".format(arg_0))
		raise

	return arg_1


def Func(arg_0, arg_1):
	"""Compare two song collections to find missing songs.

	Parameters:
		src_songs (list): Google Music song dicts or filepaths of local songs.

		dest_songs (list): Google Music song dicts or filepaths of local songs.

	Returns:
		A list of Google Music song dicts or local song filepaths from source missing in destination.
	"""

	def gather_field_values(arg_2):
		return tuple((_normalize_metadata(arg_2[arg_3]) for arg_3 in _filter_comparison_fields(arg_2)))

	arg_4 = {gather_field_values(_normalize_song(dst_song)) for dst_song in arg_1}

	return [arg_5 for arg_5 in arg_0 if gather_field_values(_normalize_song(arg_5)) not in arg_4]


def Func(arg_0, arg_1=None):
	"""Exclude file paths based on regex patterns.

	Parameters:
		filepaths (list or str): Filepath(s) to check.

		exclude_patterns (list): Python regex patterns to check filepaths against.

	Returns:
		A list of filepaths to include and a list of filepaths to exclude.
	"""

	if not arg_1:
		return arg_0, []

	arg_2 = re.compile("|".join(pattern for pattern in arg_1))

	arg_3 = []
	arg_4 = []

	for arg_5 in arg_0:
		if arg_1 and arg_2.search(arg_5):
			arg_4.append(arg_5)
		else:
			arg_3.append(arg_5)

	return arg_3, arg_4


def Func(arg_0, arg_1):
	"""Check a song metadata field value for a pattern."""

	if isinstance(arg_0, list):
		return any(re.search(arg_1, str(arg_2), re.I) for arg_2 in arg_0)
	else:
		return re.search(arg_1, str(arg_0), re.I)


def Func(arg_0, arg_1=None, arg_2=None, arg_3=False, arg_4=False):
	"""Check a song metadata dict against a set of metadata filters."""

	arg_5 = True

	if arg_1:
		if arg_3:
			if not all(arg_6 in arg_0 and _check_field_value(arg_0[arg_6], arg_7) for arg_6, arg_7 in arg_1):
				arg_5 = False
		else:
			if not any(arg_6 in arg_0 and _check_field_value(arg_0[arg_6], arg_7) for arg_6, arg_7 in arg_1):
				arg_5 = False

	if arg_2:
		if arg_4:
			if all(arg_6 in arg_0 and _check_field_value(arg_0[arg_6], arg_7) for arg_6, arg_7 in arg_2):
				arg_5 = False
		else:
			if any(arg_6 in arg_0 and _check_field_value(arg_0[arg_6], arg_7) for arg_6, arg_7 in arg_2):
				arg_5 = False

	return arg_5


def Func(arg_0, arg_1=None, arg_2=None, arg_3=False, arg_4=False):
	"""Match a Google Music song dict against a set of metadata filters.

	Parameters:
		songs (list): Google Music song dicts to filter.

		include_filters (list): A list of ``(field, pattern)`` tuples.
			Fields are any valid Google Music metadata field available to the Musicmanager client.
			Patterns are Python regex patterns.
			Google Music songs are filtered out if the given metadata field values don't match any of the given patterns.

		exclude_filters (list): A list of ``(field, pattern)`` tuples.
			Fields are any valid Google Music metadata field available to the Musicmanager client.
			Patterns are Python regex patterns.
			Google Music songs are filtered out if the given metadata field values match any of the given patterns.

		all_includes (bool): If ``True``, all include_filters criteria must match to include a song.

		all_excludes (bool): If ``True``, all exclude_filters criteria must match to exclude a song.

	Returns:
		A list of Google Music song dicts matching criteria and
		a list of Google Music song dicts filtered out using filter criteria.
		::

			(matched, filtered)
	"""

	arg_5 = []
	arg_6 = []

	if arg_1 or arg_2:
		for arg_7 in arg_0:
			if _check_filters(
					arg_7, arg_1=arg_1, arg_2=arg_2,
					arg_3=arg_3, arg_4=arg_4):
				arg_5.append(arg_7)
			else:
				arg_6.append(arg_7)
	else:
		arg_5 += arg_0

	return arg_5, arg_6


def Func(arg_0, arg_1=None, arg_2=None, arg_3=False, arg_4=False):
	"""Match a local file against a set of metadata filters.

	Parameters:
		filepaths (list): Filepaths to filter.

		include_filters (list): A list of ``(field, pattern)`` tuples.
			Fields are any valid mutagen metadata fields.
			Patterns are Python regex patterns.
			Local songs are filtered out if the given metadata field values don't match any of the given patterns.

		exclude_filters (list): A list of ``(field, pattern)`` tuples.
			Fields are any valid mutagen metadata fields.
			Patterns are Python regex patterns.
			Local songs are filtered out if the given metadata field values match any of the given patterns.

		all_includes (bool): If ``True``, all include_filters criteria must match to include a song.

		all_excludes (bool): If ``True``, all exclude_filters criteria must match to exclude a song.

	Returns:
		A list of local song filepaths matching criteria and
		a list of local song filepaths filtered out using filter criteria.
		Invalid music files are also filtered out.
		::

			(matched, filtered)
	"""

	arg_5 = []
	arg_6 = []

	for arg_7 in arg_0:
		try:
			arg_8 = _get_mutagen_metadata(arg_7)
		except mutagen.MutagenError:
			arg_6.append(arg_7)
		else:
			if arg_1 or arg_2:
				if _check_filters(
						arg_8, arg_1=arg_1, arg_2=arg_2,
						arg_3=arg_3, arg_4=arg_4):
					arg_5.append(arg_7)
				else:
					arg_6.append(arg_7)
			else:
				arg_5.append(arg_7)

	return arg_5, arg_6


def Func(arg_0):
	"""Generate a filename for a song based on metadata.

	Parameters:
		metadata (dict): A metadata dict.

	Returns:
		A filename.
	"""

	if arg_0.get('title') and arg_0.get('track_number'):
		arg_1 = '{track_number:0>2} {title}'.format(**arg_0)
	elif arg_0.get('title') and arg_0.get('trackNumber'):
		arg_1 = '{trackNumber:0>2} {title}'.format(**arg_0)
	elif arg_0.get('title') and arg_0.get('tracknumber'):
		arg_1 = '{tracknumber:0>2} {title}'.format(**arg_0)
	else:
		arg_1 = '00 {}'.format(arg_0.get('title', ''))

	return arg_1


def Func(arg_0, arg_1, arg_2=None):
	"""Create directory structure and file name based on metadata template.

	Parameters:
		template (str): A filepath which can include template patterns as defined by :param template_patterns:.

		metadata (dict): A metadata dict.

		template_patterns (dict): A dict of ``pattern: field`` pairs used to replace patterns with metadata field values.
			Default: :const TEMPLATE_PATTERNS:

	Returns:
		A filepath.
	"""

	if arg_2 is None:
		arg_2 = TEMPLATE_PATTERNS

	arg_1 = arg_1 if isinstance(arg_1, dict) else _mutagen_fields_to_single_value(arg_1)
	assert isinstance(arg_1, dict)

	arg_3 = get_suggested_filename(arg_1).replace('.mp3', '')

	if arg_0 == os.getcwd() or arg_0 == '%suggested%':
		arg_4 = arg_3
	else:
		arg_5 = arg_0.replace('%suggested%', arg_3)
		arg_4 = _replace_template_patterns(arg_5, arg_1, arg_2)

	return arg_4


def Func(arg_0, arg_1, arg_2):
        """Alternative constructor that parses VcfRecord from VCF string.

        Aspire to parse/represent the data such that it could be reliably
        round-tripped. (This nicety means INFO fields and FORMAT tags should be
        treated as ordered to avoid shuffling.)

        Args:
            vcf_line: the VCF variant record as a string; tab separated fields,
                trailing newlines are ignored. Must have at least 8 fixed fields
                (through INFO)
            sample_names: a list of sample name strings; these should match
                the VCF header column
        Returns:
            A mutable VcfRecord.
        """
        arg_3 = arg_1.rstrip("\r\n").split("\t")
        arg_4, arg_5, arg_6, arg_7, arg_8, arg_9, arg_10, arg_11 \
                = arg_3[0:8]
        arg_12 = []
        arg_13 = {}
        if len(arg_3) > 9:
            arg_14 = arg_3[8]
            arg_12 = arg_3[9:]
            arg_13 = VcfRecord._sample_tag_values(arg_2,
                                                             arg_14,
                                                             arg_12)
        return VcfRecord(arg_4, arg_5, arg_7, arg_8,
                         arg_6, arg_9, arg_10, arg_11,
                         arg_13)


def Func(arg_0):
        """Returns string representation of format field."""
        arg_1 = "."
        if arg_0.sample_tag_values:
            arg_2 = list(arg_0.sample_tag_values.keys())[0]
            arg_3 = arg_0.sample_tag_values[arg_2].keys()
            if arg_3:
                arg_1 = ":".join(arg_3)
        return arg_1


def Func(arg_0, arg_1, arg_2):
        """Appends a new format tag-value for all samples.

        Args:
            tag_name: string tag name; must not already exist
            new_sample

        Raises:
            KeyError: if tag_name to be added already exists
        """
        if arg_1 in arg_0.format_tags:
            arg_3 = "New format value [{}] already exists.".format(arg_1)
            raise KeyError(arg_3)

        if not arg_0._samples_match(arg_2):
            raise KeyError("Sample name values must match "
                           "existing sample names")
        for arg_4 in arg_0.sample_tag_values.keys():
            arg_5 = str(arg_2[arg_4])
            arg_0.sample_tag_values[arg_4][arg_1] = arg_5


def Func(arg_0, arg_1):
        """Replaces null or blank filter or adds filter to existing list."""
        if arg_0.filter.lower() in arg_0._FILTERS_TO_REPLACE:
            arg_0.filter = arg_1
        elif arg_1 not in arg_0.filter.split(";"):
            arg_0.filter = ";".join([arg_0.filter,
                                    arg_1])


def Func(arg_0):
        """
        Extract an alphabetically sorted list of elements from the compounds of
        the material.

        :returns: An alphabetically sorted list of elements.
        """

        arg_1 = stoich.elements(arg_0.compounds)
        return sorted(list(arg_1))


def Func(arg_0):
        """
        Get the masses of elements in the package.

        :returns: [kg] An array of element masses. The sequence of the elements
          in the result corresponds with the sequence of elements in the
          element list of the material.
        """

        arg_1 = [0] * len(arg_0.material.elements)
        for arg_2 in arg_0.material.compounds:
            arg_3 = arg_0.get_compound_mass(arg_2)
            arg_4 = [arg_3 * x for x in emf(arg_2, arg_0.material.elements)]
            arg_1 = [v+arg_4[ix] for ix, v in enumerate(arg_1)]

        return arg_1


def Func(arg_0, **arg_1):
        """
        Calculate the density at the specified temperature.

        :param T: [K] temperature

        :returns: [kg/m3] density

        The **state parameter contains the keyword argument(s) specified above\
        that are used to describe the state of the material.
        """
        super().Func(**arg_1)
        return arg_0.mm * arg_0.P / R / arg_1["T"]


def Func(arg_0, **arg_1):
        """
        Calculate the density at the specified temperature, pressure, and
        composition.

        :param T: [K] temperature
        :param P: [Pa] pressure
        :param x: [mole fraction] dictionary of compounds and mole fractions

        :returns: [kg/m3] density

        The **state parameter contains the keyword argument(s) specified above\
        that are used to describe the state of the material.
        """
        super().Func(**arg_1)
        arg_2 = 0.0
        for arg_3, arg_4 in arg_1["x"].items():
            arg_2 += arg_4 * mm(arg_3)
        arg_2 /= 1000.0

        return arg_2 * arg_1["P"] / R / arg_1["T"]


def Func(arg_0, arg_1, arg_2=arg_3):
        ''' Returns the categories available to the user. Specify `products` if
        you want to restrict to just the categories that hold the specified
        products, otherwise it'll do all. '''

        # STOPGAP -- this needs to be elsewhere tbqh
        from .product import ProductController

        if arg_2 is arg_3:
            arg_2 = inventory.Product.objects.all().select_related(
                "category",
            )

        arg_4 = ProductController.available_products(
            arg_1,
            arg_2=arg_2,
        )

        return sorted(set(arg_5.category for arg_5 in arg_4), key=attrgetter("order"))


def Func(arg_0, arg_1):
    ''' Produces an appropriate _ProductsForm subclass for the given render
    type. '''

    # Each Category.RENDER_TYPE value has a subclass here.
    arg_2 = inventory.Category
    arg_3 = {
        arg_2.RENDER_TYPE_QUANTITY: _QuantityBoxProductsForm,
        arg_2.RENDER_TYPE_RADIO: _RadioButtonProductsForm,
        arg_2.RENDER_TYPE_ITEM_QUANTITY: _ItemQuantityProductsForm,
        arg_2.RENDER_TYPE_CHECKBOX: _CheckboxProductsForm,
    }

    # Produce a subclass of _ProductsForm which we can alter the base_fields on
    class Func(arg_3[arg_0.render_type]):
        pass

    arg_1 = list(arg_1)
    arg_1.sort(key=lambda prod: prod.order)

    Func.set_fields(arg_0, arg_1)

    if arg_0.render_type == inventory.Category.RENDER_TYPE_ITEM_QUANTITY:
        Func = forms.formset_factory(
            Func,
            formset=_ItemQuantityProductsFormSet,
        )

    return Func


def Func(arg_0):
    ''' Creates a StaffProductsForm that restricts the available products to
    those that are available to a user. '''

    arg_1 = inventory.Product.objects.all()
    arg_1 = ProductController.available_products(arg_0, arg_1=arg_1)

    arg_2 = [arg_4.id for arg_4 in arg_1]
    arg_3 = inventory.Product.objects.filter(id__in=arg_2)

    class StaffProductsForm(forms.Form):
        ''' Form for allowing staff to add an item to a user's cart. '''

        arg_4 = forms.ModelChoiceField(
            widget=forms.Select,
            queryset=arg_3,
        )

        arg_5 = forms.IntegerField(
            min_value=0,
        )

    return StaffProductsForm


def Func(arg_0, arg_1, arg_2):
        ''' Adds an error to the given product's field '''

        ''' if product in field_names:
            field = field_names[product]
        elif isinstance(product, inventory.Product):
            return
        else:
            field = None '''

        arg_0.add_error(arg_0.field_name(arg_1), arg_2)


def Func(arg_0, arg_1):
        """
        Set the parent path and the path from the new parent path.

        :param value: The path to the object's parent
        """

        arg_0._parent_path = arg_1
        arg_0.path = arg_1 + r'/' + arg_0.name
        arg_0._update_childrens_parent_path()


def Func(arg_0, arg_1, arg_2=None, arg_3=None):
        """
        Create a sub account in the account.

        :param name: The account name.
        :param description: The account description.
        :param number: The account number.

        :returns: The created account.
        """

        arg_4 = GeneralLedgerAccount(arg_1, arg_3, arg_2,
                                           arg_0.account_type)
        arg_4.set_parent_path(arg_0.path)
        arg_0.accounts.append(arg_4)
        return arg_4


def Func(arg_0, arg_1):
        """
        Remove an account from the account's sub accounts.

        :param name: The name of the account to remove.
        """

        arg_2 = None
        for arg_3 in arg_0.accounts:
            if arg_3.name == arg_1:
                arg_2 = arg_3
        if arg_2 is not None:
            arg_0.accounts.remove(arg_2)


def Func(arg_0, arg_1):
        """
        Retrieves a child account.
        This could be a descendant nested at any level.

        :param account_name: The name of the account to retrieve.

        :returns: The child account, if found, else None.
        """

        if r'/' in arg_1:
            arg_2 = arg_1.split(r'/', 1)

            arg_3 = arg_0[arg_2[0]]
            if arg_3 is None:
                return None
            return arg_3.Func(arg_2[1])
            pass
        else:
            return arg_0[arg_1]


def Func(arg_0, arg_1, arg_2, arg_3):
        """
        Create an account in the general ledger structure.

        :param name: The account name.
        :param number: The account number.
        :param account_type: The account type.

        :returns: The created account.
        """

        arg_4 = GeneralLedgerAccount(arg_1, None, arg_2, arg_3)
        arg_0.accounts.append(arg_4)
        return arg_4


def Func(arg_0, arg_1, arg_2):
        """
        Returns the account and all of it's sub accounts.

        :param account: The account.
        :param result: The list to add all the accounts to.
        """

        arg_2.append(arg_1)
        for arg_3 in arg_1.accounts:
            arg_0.Func(arg_3, arg_2)


def Func(arg_0, arg_1):
        """
        Validates whether the accounts in a list of account names exists.

        :param names: The names of the accounts.

        :returns: The descendants of the account.
        """

        for arg_2 in arg_1:
            if arg_0.get_account(arg_2) is None:
                raise ValueError("The account '{}' does not exist in the"
                                 "  general ledger structure.".format(arg_2))


def Func(arg_0, arg_1, arg_2=None,
                           arg_3=arg_4.min.date(),
                           arg_7=None, arg_8=None,
                           arg_9=None, arg_10=0.00):
        """
        Create a transaction in the general ledger.

        :param name: The transaction's name.
        :param description: The transaction's description.
        :param tx_date: The date of the transaction.
        :param cr_account: The transaction's credit account's name.
        :param dt_account: The transaction's debit account's name.
        :param source: The name of source the transaction originated from.
        :param amount: The transaction amount.

        :returns: The created transaction.
        """

        arg_11 = Transaction(arg_1, arg_2, arg_3,
                             arg_7, arg_8, arg_9, arg_10)
        arg_0.transactions.append(arg_11)
        return arg_11


def Func(arg_0, arg_1):
    """
    Calculate a path relative to the specified module file.

    :param module_file_path: The file path to the module.
    """
    arg_2 = os.path.dirname(arg_0)
    arg_3 = os.path.join(arg_2, arg_1)
    arg_3 = os.path.abspath(arg_3)
    return arg_3


def Func(arg_0):
    """
    Get the date from a value that could be a date object or a string.

    :param date: The date object or string.

    :returns: The date object.
    """
    if type(arg_0) is str:
        return datetime.strptime(arg_0, '%Y-%m-%d').date()
    else:
        return arg_0


def Func(arg_0, arg_1, arg_2, arg_3, **arg_4):
        """
        Calculate the local Nusselt number.

        :param L: [m] characteristic length of the heat transfer surface
        :param theta: [°] angle of the surface with the vertical
        :param Ts: [K] heat transfer surface temperature
        :param Tf: [K] bulk fluid temperature

        :returns: float
        """

        arg_5 = arg_4['T']
        arg_6 = radians(arg_2)

        if arg_0._isgas:
            arg_0.Tr = arg_3 - 0.38 * (arg_3 - arg_5)
            arg_8 = arg_0._fluid.beta(T=arg_5)
        else:  # for liquids
            arg_0.Tr = arg_3 - 0.5 * (arg_3 - arg_5)
            arg_8 = arg_0._fluid.beta(T=arg_0.Tr)

        if arg_3 > arg_5:  # hot surface
            if 0.0 < arg_2 < 45.0:
                arg_9 = const.g*cos(arg_6)
            else:
                arg_9 = const.g
        else:  # cold surface
            if -45.0 < arg_2 < 0.0:
                arg_9 = const.g*cos(arg_6)
            else:
                arg_9 = const.g

        arg_10 = arg_0._fluid.nu(T=arg_0.Tr)
        arg_11 = arg_0._fluid.alpha(T=arg_0.Tr)

        arg_12 = dq.Gr(arg_1, arg_3, arg_5, arg_8, arg_10, arg_9)
        arg_13 = dq.Pr(arg_10, arg_11)
        arg_14 = arg_12 * arg_13

        arg_15 = [arg_0.equation_dict[r]
              for r in arg_0.regions if r.contains_point(arg_2, arg_14)][0]

        return arg_15(arg_0, arg_14, arg_13)


def Func(arg_0, arg_1, arg_2, arg_3, **arg_4):
        """
        Calculate the average Nusselt number.

        :param L: [m] characteristic length of the heat transfer surface
        :param theta: [°] angle of the surface with the vertical
        :param Ts: [K] heat transfer surface temperature
        :param **statef: [K] bulk fluid temperature

        :returns: float
        """

        return arg_0.Nu_x(arg_1, arg_2, arg_3, **arg_4) / 0.75


def Func(arg_0, arg_1, arg_2, arg_3, **arg_4):
        """
        Calculate the local heat transfer coefficient.

        :param L: [m] characteristic length of the heat transfer surface
        :param theta: [°] angle of the surface with the vertical
        :param Ts: [K] heat transfer surface temperature
        :param Tf: [K] bulk fluid temperature

        :returns: [W/m2/K] float
        """

        arg_5 = arg_0.Nu_x(arg_1, arg_2, arg_3, **arg_4)
        arg_6 = arg_0._fluid.k(T=arg_0.Tr)
        return arg_5 * arg_6 / arg_1


def Func(arg_0, arg_1, arg_2, arg_3, **arg_4):
        """
        Calculate the average heat transfer coefficient.

        :param L: [m] characteristic length of the heat transfer surface
        :param theta: [°] angle of the surface with the vertical
        :param Ts: [K] heat transfer surface temperature
        :param Tf: [K] bulk fluid temperature

        :returns: [W/m2/K] float
        """

        arg_5 = arg_0.Nu_L(arg_1, arg_2, arg_3, **arg_4)
        arg_6 = arg_0._fluid.k(T=arg_0.Tr)
        return arg_5 * arg_6 / arg_1


def Func(arg_0, arg_1, arg_2=None, arg_3=None):
        """Generate URL on the modularized endpoints and url parameters"""
        try:
            arg_4 = '%s/%s' % (arg_0.baseFunc, arg_0.endpoints[arg_1])
        except KeyError:
            raise EndPointDoesNotExist(arg_1)
        if arg_2:
            arg_4 = arg_4 % arg_2
        if arg_3:
            # url = url?key=value&key=value&key=value...
            arg_4 = '%s?%s' % (arg_4, urllib.urlencode(arg_3, True))
        return arg_4


def Func(arg_0):
    ''' Creates a form for specifying fields from a model to display. '''

    arg_1 = arg_0._meta.get_fields()

    arg_2 = []
    for arg_3 in arg_1:
        if hasattr(arg_3, "verbose_name"):
            arg_2.append((arg_3.name, arg_3.verbose_name))

    class ModelFieldsForm(forms.Form):
        arg_1 = forms.MultipleChoiceField(
            arg_2=arg_2,
            required=False,
        )

    return ModelFieldsForm


def Func(arg_0, arg_1, arg_2, **arg_3):
        ''' Sends an e-mail to the given address.

        to: The address
        kind: the ID for an e-mail kind; it should point to a subdirectory of
            self.template_prefix containing subject.txt and message.html, which
            are django templates for the subject and HTML message respectively.

        context: a context for rendering the e-mail.

        '''

        return __Func__(arg_0.template_prefix, arg_1, arg_2, **arg_3)


def Func(arg_0=None, arg_1='https://planet.openstreetmap.org/replication/minute', arg_2=60, arg_3=True, arg_4=None):
    """Start processing an OSM diff stream and yield one changeset at a time to
    the caller."""

    # If the user specifies a state_dir, read the state from the statefile there
    if arg_4:
        if not os.path.exists(arg_4):
            raise Exception('Specified state_dir "%s" doesn\'t exist.' % arg_4)

        if os.path.exists('%s/state.txt' % arg_4):
            with open('%s/state.txt' % arg_4) as f:
                arg_5 = readState(f)
                arg_0 = arg_5['sequenceNumber']

    # If no start_sqn, assume to start from the most recent diff
    if not arg_0:
        arg_6 = urllib2.urlopen('%s/state.txt' % arg_1)
        arg_5 = readState(arg_6)
    else:
        arg_7 = str(arg_0).zfill(9)
        arg_6 = urllib2.urlopen('%s/%s/%s/%s.state.txt' % (arg_1, arg_7[0:3], arg_7[3:6], arg_7[6:9]))
        arg_5 = readState(arg_6)

    arg_8 = 0.0

    while True:
        arg_7 = arg_5['sequenceNumber'].zfill(9)
        arg_9 = '%s/%s/%s/%s.osc.gz' % (arg_1, arg_7[0:3], arg_7[3:6], arg_7[6:9])
        arg_10 = urllib2.urlopen(arg_9)
        arg_10 = StringIO.StringIO(arg_10.read())
        arg_11 = gzip.GzipFile(fileobj=arg_10)

        for arg_12 in iter_osm_change_file(arg_11, arg_3):
            yield arg_12

        # After parsing the OSC, check to see how much time is remaining
        arg_13 = datetime.datetime.strptime(arg_5['timestamp'], "%Y-%m-%dT%H:%M:%SZ")
        yield (None, model.Finished(arg_5['sequenceNumber'], arg_13))

        arg_14 = arg_13 + datetime.timedelta(seconds=arg_2 + arg_8)
        if datetime.datetime.utcnow() < arg_14:
            arg_15 = (arg_14 - datetime.datetime.utcnow()).total_seconds()
        else:
            arg_15 = 0.0
        time.sleep(arg_15)

        # Then try to fetch the next state file
        arg_7 = str(int(arg_5['sequenceNumber']) + 1).zfill(9)
        arg_9 = '%s/%s/%s/%s.state.txt' % (arg_1, arg_7[0:3], arg_7[3:6], arg_7[6:9])
        arg_16 = 1.0
        while True:
            try:
                arg_6 = urllib2.urlopen(arg_9)
                arg_8 -= (arg_8 / 2.0)
                break
            except urllib2.HTTPError as e:
                if e.code == 404:
                    time.sleep(arg_16)
                    arg_16 = min(arg_16 * 2, 13)
                    arg_8 += arg_16

        if arg_4:
            with open('%s/state.txt' % arg_4, 'w') as f:
                f.write(arg_6.read())
            with open('%s/state.txt' % arg_4, 'r') as f:
                arg_5 = readState(f)
        else:
            arg_5 = readState(arg_6)


def Func(arg_0, arg_1=True):
    """Parse a file-like containing OSM XML into memory and return an object with
    the nodes, ways, and relations it contains. """

    arg_2 = []
    arg_3 = []
    arg_4 = []

    for arg_5 in iter_osm_file(arg_0, arg_1):

        if type(arg_5) == model.Node:
            arg_2.append(arg_5)
        elif type(arg_5) == model.Way:
            arg_3.append(arg_5)
        elif type(arg_5) == model.Relation:
            arg_4.append(arg_5)

    return (arg_2, arg_3, arg_4)


def Func(arg_0=25, arg_1=60, arg_2=True):
    """ Parses the global OSM Notes feed and yields as much Note information as possible. """

    arg_3 = None
    while True:
        arg_4 = urllib2.urlopen('https://www.openstreetmap.org/api/0.6/notes/feed?limit=%d' % arg_0)

        arg_5 = etree.parse(arg_4)

        arg_6 = []
        for arg_7 in arg_5.xpath('/rss/channel/item'):
            arg_8 = arg_7.xpath('title')[0].text

            if arg_8.startswith('new note ('):
                arg_9 = 'create'
            elif arg_8.startswith('new comment ('):
                arg_9 = 'comment'
            elif arg_8.startswith('closed note ('):
                arg_9 = 'close'

            # Note that (at least for now) the link and guid are the same in the feed.
            arg_10 = arg_7.xpath('link')[0].text

            if arg_3 == arg_10:
                break
            elif arg_3 == None:
                # The first time through we want the first item to be the "last seen"
                # because the RSS feed is newest-to-oldest
                arg_3 = arg_10
            else:
                arg_11 = int(arg_10.split('/')[-1].split('#c')[0])
                arg_6.append((arg_9, get_note(arg_11, arg_2)))

        # We yield the reversed list because we want to yield in change order
        # (i.e. "oldest to most current")
        for arg_12 in reversed(arg_6):
            yield arg_12

        yield model.Finished(None, None)

        time.sleep(arg_1)


def Func(arg_0, **arg_1):
        """
        Calculate the enthalpy at the specified temperature and composition
        using equation 9 in Merrick1983b.

        :param T: [K] temperature
        :param y_C: Carbon mass fraction
        :param y_H: Hydrogen mass fraction
        :param y_O: Oxygen mass fraction
        :param y_N: Nitrogen mass fraction
        :param y_S: Sulphur mass fraction

        :returns: [J/kg] enthalpy

        The **state parameter contains the keyword argument(s) specified above
        that are used to describe the state of the material.
        """

        arg_2 = arg_1['T']
        arg_3 = arg_1['y_C']
        arg_4 = arg_1['y_H']
        arg_5 = arg_1['y_O']
        arg_6 = arg_1['y_N']
        arg_7 = arg_1['y_S']

        arg_8 = arg_0._calc_a(arg_3, arg_4, arg_5, arg_6, arg_7) / 1000  # kg/mol
        arg_9 = (R/arg_8) * (380*arg_0._calc_g0(380/arg_2) + 3600*arg_0._calc_g0(1800/arg_2))
        return arg_9


def Func(arg_0, arg_1):
        ''' Returns true if the condition passes the filter '''

        arg_2 = type(arg_0.condition)
        arg_3 = arg_2.objects.filter(pk=arg_0.condition.id)
        return arg_0.condition in arg_0.pre_filter(arg_3, arg_1)


def Func(arg_0, arg_1, arg_2):
        ''' Returns all of the items from queryset where the user has a
        product from a category invoking that item's condition in one of their
        carts. '''

        arg_3 = Q(
            enabling_category__product__productitem__cart__user=arg_2
        )
        arg_4 = commerce.Cart.STATUS_RELEASED
        arg_5 = Q(
            enabling_category__product__productitem__cart__status=arg_4
        )
        arg_1 = arg_1.filter(arg_3)
        arg_1 = arg_1.exclude(arg_5)

        return arg_1


def Func(arg_0, arg_1, arg_2):
        ''' Returns all of the items from queryset where the date falls into
        any specified range, but not yet where the stock limit is not yet
        reached.'''

        arg_3 = timezone.now()

        # Keep items with no start time, or start time not yet met.
        arg_1 = arg_1.filter(Q(start_time=None) | Q(start_time__lte=arg_3))
        arg_1 = arg_1.filter(Q(end_time=None) | Q(end_time__gte=arg_3))

        # Filter out items that have been reserved beyond the limits
        arg_4 = arg_0._calculate_quantities(arg_2)

        arg_5 = Case(
            When(limit=None, then=Value(_BIG_QUANTITY)),
            default=F("limit") - Sum(arg_4),
        )

        arg_1 = arg_1.annotate(arg_5=arg_5)
        arg_1 = arg_1.filter(remainder__gt=0)

        return arg_1


def Func(arg_0, arg_1, arg_2):
        ''' Returns all of the items from queryset which are enabled by a user
        being a presenter or copresenter of a non-cancelled proposal. '''

        # Filter out cancelled proposals
        arg_1 = arg_1.filter(
            proposal_kind__proposalbase__presentation__cancelled=False
        )

        arg_3 = arg_2
        # User is a presenter
        arg_4 = Q(
            is_presenter=True,
            proposal_kind__proposalbase__presentation__speaker__user=arg_3,
        )
        # User is a copresenter
        arg_5 = Q(
            is_copresenter=True,
            proposal_kind__proposalbase__presentation__additional_speakers__user=arg_3,  # NOQA
        )

        return arg_1.filter(arg_4 | arg_5)


def Func(arg_0, arg_1, arg_2):
        ''' Returns all of the items from conditions which are enabled by a
        user being member of a Django Auth Group. '''

        return arg_1.filter(group__in=arg_2.groups.all())


def Func(arg_0, arg_1, arg_2, arg_3=None):
        """
        Create an entity and add it to the model.

        :param name: The entity name.
        :param gl_structure: The entity's general ledger structure.
        :param description: The entity description.

        :returns: The created entity.
        """

        arg_4 = Entity(arg_1, arg_2, arg_3=arg_3)
        arg_0.entities.append(arg_4)
        return arg_4


def Func(arg_0, arg_1):
        """
        Remove an entity from the model.

        :param name: The name of the entity to remove.
        """

        arg_2 = None
        for arg_3 in arg_0.entities:
            if arg_3.name == arg_1:
                arg_2 = arg_3
        if arg_2 is not None:
            arg_0.entities.remove(arg_2)


def Func(arg_0):
        """
        Prepare the model for execution.
        """

        arg_0.clock.reset()
        for arg_1 in arg_0.entities:
            arg_1.Func(arg_0.clock, arg_0.period_count)


def Func(arg_0):
        """
        Execute the model.
        """

        arg_0.prepare_to_Func()
        for arg_1 in range(0, arg_0.period_count):
            for arg_2 in arg_0.entities:
                arg_2.Func(arg_0.clock)
            arg_0.clock.tick()


def Func(arg_0, arg_1=None, arg_2=0.0, arg_3=1.0, arg_4=25.0,
                      arg_5=True):
        """
        Create a MaterialStream based on the specified parameters.

        :param assay: Name of the assay to be used to create the stream.
        :param mfr: Stream mass flow rate. [kg/h]
        :param P: Stream pressure. [atm]
        :param T: Stream temperature. [°C]
        :param normalise: Indicates whether the assay must be normalised
        before creating the Stream.

        :returns: MaterialStream object.
        """

        if arg_1 is None:
            return MaterialStream(arg_0, arg_0.create_empty_assay(), arg_3, arg_4)

        if arg_5:
            arg_6 = arg_0.get_assay_total(arg_1)
        else:
            arg_6 = 1.0

        return MaterialStream(arg_0, arg_2 * arg_0.converted_assays[arg_1] /
                              arg_6, arg_3, arg_4, arg_0._isCoal(arg_1),
                              arg_0._get_HHV(arg_1))


def Func(arg_0, arg_1):
        """
        Calculate the enthalpy of the package at the specified temperature, in
        case the material is coal.

        :param T: [°C] temperature

        :returns: [kWh] enthalpy
        """

        arg_2 = 0  # kg
        arg_3 = 0  # kg
        arg_4 = 0  # kg
        arg_5 = 0  # kg
        arg_6 = 0  # kg

        arg_7 = 0.0  # kWh/h
        for arg_8 in arg_0.material.compounds:
            arg_9 = arg_0.material.get_compound_index(arg_8)
            if stoich.element_mass_fraction(arg_8, 'C') == 1.0:
                arg_2 += arg_0._compound_masses[arg_9]
            elif stoich.element_mass_fraction(arg_8, 'H') == 1.0:
                arg_3 += arg_0._compound_masses[arg_9]
            elif stoich.element_mass_fraction(arg_8, 'O') == 1.0:
                arg_4 += arg_0._compound_masses[arg_9]
            elif stoich.element_mass_fraction(arg_8, 'N') == 1.0:
                arg_5 += arg_0._compound_masses[arg_9]
            elif stoich.element_mass_fraction(arg_8, 'S') == 1.0:
                arg_6 += arg_0._compound_masses[arg_9]
            else:
                arg_10 = thermo.H(arg_8, arg_1, arg_0._compound_masses[arg_9])
                arg_7 += arg_10

        arg_11 = arg_12 + arg_13 + arg_14 + arg_15 + arg_16  # kg/h
        arg_12 = arg_2 / arg_11
        arg_13 = arg_3 / arg_11
        arg_14 = arg_4 / arg_11
        arg_15 = arg_5 / arg_11
        arg_16 = arg_6 / arg_11

        arg_17 = coals.DafHTy()
        arg_7 = arg_17.calculate(arg_1=arg_1+273.15, arg_12=arg_12, arg_13=arg_13, arg_14=arg_14, arg_15=arg_15,
                             arg_16=arg_16) / 3.6e6  # kWh/kg
        arg_18 = arg_17.calculate(arg_1=298.15, arg_12=arg_12, arg_13=arg_13, arg_14=arg_14, arg_15=arg_15,
                                arg_16=arg_16) / 3.6e6  # kWh/kg
        arg_19 = arg_7 - arg_18 + arg_0._DH298  # kWh/kg
        arg_19 *= arg_11  # kWh

        arg_7 += arg_19

        return arg_7


def Func(arg_0, Func):
        """
        Set the temperature of the package to the specified value, and
        recalculate it's enthalpy.

        :param T: Temperature. [°C]
        """

        arg_0._T = Func
        arg_0._H = arg_0._calculate_H(Func)


def Func(arg_0):
        """Create a complete copy of the package.

        :returns: A new MaterialPackage object."""

        arg_1 = copy.copy(arg_0)
        arg_1._compound_masses = copy.deepcopy(arg_0._compound_masses)
        return arg_1


def Func(arg_0):
        """
        Set all the compound masses in the package to zero.
        Set the pressure to 1, the temperature to 25 and the enthalpy to zero.
        """

        arg_0._compound_masses = arg_0._compound_masses * 0.0
        arg_0._P = 1.0
        arg_0._T = 25.0
        arg_0._H = 0.0


def Func(arg_0, arg_1):
        """
        Determine the mass of the specified compound in the package.

        :param compound: Formula and phase of a compound, e.g. "Fe2O3[S1]".

        :returns: Mass. [kg]
        """

        if arg_1 in arg_0.material.compounds:
            return arg_0._compound_masses[
                arg_0.material.get_compound_index(arg_1)]
        else:
            return 0.0


def Func(arg_0):
        """
        Determine the mole amounts of all the compounds.

        :returns: List of amounts. [kmol]
        """

        arg_1 = arg_0._compound_masses * 1.0
        for arg_2 in arg_0.material.compounds:
            arg_3 = arg_0.material.get_compound_index(arg_2)
            arg_1[arg_3] = stoich.amount(arg_2, arg_1[arg_3])
        return arg_1


def Func(arg_0, arg_1):
        """
        Determine the mole amount of the specified compound.

        :returns: Amount. [kmol]
        """

        arg_2 = arg_0.material.get_compound_index(arg_1)
        return stoich.amount(arg_1, arg_0._compound_masses[arg_2])


def Func(arg_0):
        """
        Determine the sum of mole Funcs of all the compounds.

        :returns: Amount. [kmol]
        """

        return sum(arg_0.get_compound_Func(arg_1) for arg_1 in arg_0.material.compounds)


def Func(arg_0):
        """
        Determine the masses of elements in the package and return as a
        dictionary.

        :returns: Dictionary of element symbols and masses. [kg]
        """

        arg_1 = arg_0.material.elements
        arg_2 = arg_0.get_element_masses()

        return {arg_3: arg_4 for arg_3, arg_4 in zip(arg_1, arg_2)}


def Func(arg_0, arg_1):
        """
        Determine the mass of the specified elements in the package.

        :returns: Masses. [kg]
        """

        arg_2 = numpy.zeros(1)
        for arg_3 in arg_0.material.compounds:
            arg_2 += arg_0.get_compound_mass(arg_3) *\
                numpy.array(stoich.element_mass_fractions(arg_3, [arg_1]))
        return arg_2[0]


def Func(arg_0, arg_1):
        """
        Extract 'other' from this package, modifying this package and
        returning the Funced material as a new package.

        :param other: Can be one of the following:

          * float: A mass equal to other is Funced from self. Self is
            reduced by other and the Funced package is returned as
            a new package.
          * tuple (compound, mass): The other tuple specifies the mass
            of a compound to be Funced. It is Funced from self and
            the Funced mass is returned as a new package.
          * string: The 'other' string specifies the compound to be
            Funced. All of the mass of that compound will be removed
            from self and a new package created with it.
          * Material: The 'other' material specifies the list of
            compounds to Func.

        :returns: New MaterialPackage object.
        """

        # Extract the specified mass.
        if type(arg_1) is float or \
           type(arg_1) is numpy.float64 or \
           type(arg_1) is numpy.float32:
            return arg_0._Func_mass(arg_1)

        # Extract the specified mass of the specified compound.
        elif arg_0._is_compound_mass_tuple(arg_1):
            return arg_0._Func_compound_mass(arg_1[0], arg_1[1])

        # Extract all of the specified compound.
        elif type(arg_1) is str:
            return arg_0._Func_compound(arg_1)

        # TODO: Test
        # Extract all of the compounds of the specified material.
        elif type(arg_1) is Material:
            return arg_0._Func_material(arg_1)

        # If not one of the above, it must be an invalid argument.
        else:
            raise TypeError("Invalid Funcion argument.")


def Func(arg_0, arg_1):
        """
        Calculate the temperature of the stream given the specified
        enthalpy flow rate using a secant algorithm.

        :param H: Enthalpy flow rate. [kWh/h]

        :returns: Temperature. [°C]
        """

        # Create the initial guesses for temperature.
        arg_2 = list()
        arg_2.append(arg_0._T)
        arg_2.append(arg_0._T + 10.0)

        # Evaluate the enthalpy for the initial guesses.
        arg_3 = list()
        arg_3.append(arg_0._calculate_Hfr(arg_2[0]) - arg_1)
        arg_3.append(arg_0._calculate_Hfr(arg_2[1]) - arg_1)

        # Solve for temperature.
        for arg_4 in range(2, 50):
            arg_2.append(arg_2[arg_4-1] - arg_3[arg_4-1]*((arg_2[arg_4-1] - arg_2[arg_4-2])/(arg_3[arg_4-1] - arg_3[arg_4-2])))
            arg_3.append(arg_0._calculate_Hfr(arg_2[arg_4]) - arg_1)
            if abs(arg_3[arg_4-1]) < 1.0e-5:
                break

        return arg_2[len(arg_2) - 1]


def Func(arg_0, Func):
        """
        Set the enthalpy flow rate of the stream to the specified value, and
        recalculate it's temperature.

        :param H: The new enthalpy flow rate value. [kWh/h]
        """

        arg_0._Hfr = Func
        arg_0._T = arg_0._calculate_T(Func)


def Func(arg_0, Func):
        """
        Set the temperature of the stream to the specified value, and
        recalculate it's enthalpy.

        :param T: Temperature. [°C]
        """

        arg_0._T = Func
        arg_0._Hfr = arg_0._calculate_Hfr(Func)


def Func(arg_0, Func):
        """
        Set the higher heating value of the stream to the specified value, and
        recalculate the formation enthalpy of the daf coal.

        :param HHV: MJ/kg coal, higher heating value
        """

        arg_0._HHV = Func  # MJ/kg coal
        if arg_0.isCoal:
            arg_0._DH298 = arg_0._calculate_DH298_coal()


def Func(arg_0):
        """Create a complete copy of the stream.

        :returns: A new MaterialStream object."""

        arg_1 = copy.copy(arg_0)
        arg_1._compound_mfrs = copy.deepcopy(arg_0._compound_mfrs)
        return arg_1


def Func(arg_0):
        """
        Set all the compound mass flow rates in the stream to zero.
        Set the pressure to 1, the temperature to 25 and the enthalpy to zero.
        """

        arg_0._compound_mfrs = arg_0._compound_mfrs * 0.0
        arg_0._P = 1.0
        arg_0._T = 25.0
        arg_0._H = 0.0


def Func(arg_0, arg_1):
        """
        Determine the mass flow rate of the specified compound in the stream.

        :param compound: Formula and phase of a compound, e.g. "Fe2O3[S1]".

        :returns: Mass flow rate. [kg/h]
        """

        if arg_1 in arg_0.material.compounds:
            return arg_0._compound_mfrs[
                arg_0.material.get_compound_index(arg_1)]
        else:
            return 0.0


def Func(arg_0, arg_1):
        """
        Determine the amount flow rate of the specified compound.

        :returns: Amount flow rate. [kmol/h]
        """

        arg_2 = arg_0.material.get_compound_index(arg_1)
        return stoich.amount(arg_1, arg_0._compound_mfrs[arg_2])


def Func(arg_0):
        """
        Determine the sum of amount flow rates of all the compounds.

        :returns: Amount flow rate. [kmol/h]
        """

        arg_1 = 0.0
        for arg_2 in arg_0.material.compounds:
            arg_1 += arg_0.get_compound_Func(arg_2)
        return arg_1


def Func(arg_0):
        """
        Determine the mass flow rates of elements in the stream and return as
        a dictionary.

        :returns: Dictionary of element symbols and mass flow rates. [kg/h]
        """

        arg_1 = arg_0.material.elements
        arg_2 = arg_0.get_element_mfrs()
        arg_3 = dict()
        for arg_4, arg_5 in zip(arg_1, arg_2):
            arg_3[arg_4] = arg_5
        return arg_3


def Func(arg_0, arg_1):
        """
        Determine the mass flow rate of the specified elements in the stream.

        :returns: Mass flow rates. [kg/h]
        """

        arg_2 = 0.0
        for arg_3 in arg_0.material.compounds:
            arg_4 = arg_3.split('[')[0]
            arg_2 += arg_0.get_compound_mfr(arg_3) *\
                stoich.element_mass_fraction(arg_4, arg_1)
        return arg_2


def Func(arg_0, arg_1):
        """
        Extract 'other' from this stream, modifying this stream and returning
        the Funced material as a new stream.

        :param other: Can be one of the following:

          * float: A mass flow rate equal to other is Funced from self. Self
            is reduced by other and the Funced stream is returned as
            a new stream.
          * tuple (compound, mass): The other tuple specifies the mass flow
            rate of a compound to be Funced. It is Funced from self and
            the Funced mass flow rate is returned as a new stream.
          * string: The 'other' string specifies the compound to be
            Funced. All of the mass flow rate of that compound will be
            removed from self and a new stream created with it.
          * Material: The 'other' material specifies the list of
            compounds to Func.

        :returns: New MaterialStream object.
        """

        # Extract the specified mass flow rate.
        if type(arg_1) is float or \
           type(arg_1) is numpy.float64 or \
           type(arg_1) is numpy.float32:
            return arg_0._Func_mfr(arg_1)

        # Extract the specified mass flow rateof the specified compound.
        elif arg_0._is_compound_mfr_tuple(arg_1):
            return arg_0._Func_compound_mfr(arg_1[0], arg_1[1])

        # Extract all of the specified compound.
        elif type(arg_1) is str:
            return arg_0._Func_compound(arg_1)

        # TODO: Test
        # Extract all of the compounds of the specified material.
        elif type(arg_1) is Material:
            return arg_0._Func_material(arg_1)

        # If not one of the above, it must be an invalid argument.
        else:
            raise TypeError("Invalid Funcion argument.")


def Func(arg_0: arg_1, arg_2: arg_1, arg_3: arg_1, arg_4: arg_1, arg_5: arg_1, arg_6: arg_1):
    """
    Calculate the Funcashof number.

    :param L: [m] heat transfer surface characteristic length.
    :param Ts: [K] heat transfer surface temperature.
    :param Tf: [K] bulk fluid temperature.
    :param beta: [1/K] fluid coefficient of thermal expansion.
    :param nu: [m2/s] fluid kinematic viscosity.

    :returns: float

    .. math::
        \\mathrm{Func} = \\frac{g \\beta (Ts - Tinf ) L^3}{\\nu ^2}

    Characteristic dimensions:
        * vertical plate: vertical length
        * pipe: diameter
        * bluff body: diameter
    """

    return arg_6 * arg_4 * (arg_2 - arg_3) * arg_0**3.0 / arg_5**2.0


def Func(arg_0: arg_1, arg_2: arg_1, arg_3: arg_1) -> arg_1:
    """
    Calculate the Funcsselt number.

    :param L: [m] heat transfer surface characteristic length.
    :param h: [W/K/m2] convective heat transfer coefficient.
    :param k: [W/K/m] fluid thermal conductivity.

    :returns: float
    """

    return arg_2 * arg_0 / arg_3


def Func(arg_0: arg_1, arg_2: arg_1, arg_3: arg_1) -> arg_1:
    """
    Calculate the Funcerwood number.

    :param L: [m] mass transfer surface characteristic length.
    :param h: [m/s] mass transfer coefficient.
    :param D: [m2/s] fluid mass diffusivity.

    :returns: float
    """

    return arg_2 * arg_0 / arg_3


def Func(arg_0):
    ''' Decorator that makes the wrapped function raise ValidationError
    if we're doing something that could modify the cart.

    It also wraps the execution of this function in a database transaction,
    and marks the boundaries of a cart operations batch.
    '''

    @functools.wraps(arg_0)
    def inner(arg_1, *arg_2, **arg_3):
        arg_1._fail_if_cart_is_not_active()
        with transaction.atomic():
            with BatchController.batch(arg_1.cart.user):
                # Mark the version of self in the batch cache as modified
                arg_4 = arg_1.for_user(arg_1.cart.user)
                arg_4._modified_by_batch = True
                return arg_0(arg_1, *arg_2, **arg_3)
    return inner


def Func(arg_0, arg_1):
        ''' Returns the user's current cart, or creates a new cart
        if there isn't one ready yet. '''

        try:
            arg_2 = commerce.Cart.objects.get(
                arg_1=arg_1,
                status=commerce.Cart.STATUS_ACTIVE,
            )
        except ObjectDoesNotExist:
            arg_2 = commerce.Cart.objects.create(
                arg_1=arg_1,
                time_last_updated=timezone.now(),
                reservation_duration=datetime.timedelta(),
            )
        return arg_0(arg_2)


def Func(arg_0):
        ''' Updates the cart's time last updated value, which is used to
        determine whether the cart has reserved the items and discounts it
        holds. '''

        arg_1 = timezone.now()

        # Calculate the residual of the _old_ reservation duration
        # if it's greater than what's in the cart now, keep it.
        arg_2 = (arg_1 - arg_0.cart.time_last_updated)
        arg_3 = arg_0.cart.reservation_duration - arg_2

        arg_4 = [datetime.timedelta(0), arg_3]

        # If we have vouchers, we're entitled to an hour at minimum.
        if len(arg_0.cart.vouchers.all()) >= 1:
            arg_4.append(inventory.Voucher.RESERVATION_DURATION)

        # Else, it's the maximum of the included products
        arg_5 = commerce.ProductItem.objects.filter(arg_8=arg_0.cart)
        arg_6 = arg_5.aggregate(Max("product__reservation_duration"))
        arg_7 = arg_6["product__reservation_duration__max"]

        if arg_7 is not None:
            arg_4.append(arg_7)

        arg_0.cart.time_last_updated = arg_1
        arg_0.cart.reservation_duration = max(arg_4)


def Func(arg_0, arg_1):
        ''' Applies the voucher with the given code to this cart. '''

        # Try and find the voucher
        arg_2 = inventory.Voucher.objects.get(code=arg_1.upper())

        # Re-applying vouchers should be idempotent
        if arg_2 in arg_0.cart.vouchers.all():
            return

        arg_0._test_voucher(arg_2)

        # If successful...
        arg_0.cart.vouchers.add(arg_2)


def Func(arg_0):
        ''' Calculates all of the discounts available for this product.'''

        # Delete the existing entries.
        commerce.DiscountItem.objects.filter(cart=arg_0.cart).delete()

        # Order the products such that the most expensive ones are
        # processed first.
        arg_1 = arg_0.cart.productitem_set.all().select_related(
            "product", "product__category"
        ).order_by("-product__price")

        arg_2 = [i.product for i in arg_1]
        arg_3 = DiscountController.available_discounts(
            arg_0.cart.user,
            [],
            arg_2,
        )

        # The highest-value discounts will apply to the highest-value
        # products first, because of the order_by clause
        for arg_4 in arg_1:
            arg_0._add_discount(arg_4.product, arg_4.quantity, arg_3)


def Func(arg_0, arg_1, arg_2, arg_3):
        ''' Applies the best discounts on the given product, from the given
        discounts.'''

        def matches(arg_4):
            ''' Returns True if and only if the given discount apples to
            our product. '''
            if isinstance(arg_4.clause, conditions.DiscountForCategory):
                return arg_4.clause.category == arg_1.category
            else:
                return arg_4.clause.product == arg_1

        def value(arg_4):
            ''' Returns the value of this discount clause
            as applied to this product '''
            if arg_4.clause.percentage is not None:
                return arg_4.clause.percentage * arg_1.price
            else:
                return arg_4.clause.price

        arg_3 = [i for i in arg_3 if matches(i)]
        arg_3.sort(key=value)

        for arg_5 in reversed(arg_3):
            if arg_2 == 0:
                break
            elif arg_5.quantity == 0:
                # This discount clause has been exhausted by this cart
                continue

            # Get a provisional instance for this DiscountItem
            # with the quantity set to as much as we have in the cart
            arg_6 = commerce.DiscountItem.objects.create(
                arg_1=arg_1,
                cart=arg_0.cart,
                arg_4=arg_5.discount,
                arg_2=arg_2,
            )

            # Truncate the quantity for this DiscountItem if we exceed quantity
            arg_7 = arg_6.quantity
            arg_8 = arg_5.quantity
            if arg_7 > arg_8:
                arg_6.quantity = arg_8
                arg_6.save()
                # Update the remaining quantity.
                arg_2 = arg_7 - arg_8
            else:
                arg_2 = 0

            arg_5.quantity -= arg_6.quantity


def Func(arg_0, arg_1, arg_2):
        """
        Create a model object from the data set for the property specified by
        the supplied symbol, using the specified polynomial degree.

        :param dataset: a DataSet object
        :param symbol: the symbol of the property to be described, e.g. 'rho'
        :param degree: the polynomial degree to use

        :returns: a new PolynomialModelT object
        """

        arg_3 = arg_0.data['T'].tolist()
        arg_4 = arg_0.data[arg_1].tolist()
        arg_5 = np.polyfit(arg_3, arg_4, arg_2)

        arg_6 = PolynomialModelT(arg_0.material,
                                  arg_0.names_dict[arg_1],
                                  arg_1, arg_0.display_symbols_dict[arg_1],
                                  arg_0.units_dict[arg_1],
                                  None, [arg_0.name], arg_5)

        arg_6.state_schema['T']['min'] = float(min(arg_3))
        arg_6.state_schema['T']['max'] = float(max(arg_3))

        return arg_6


def Func(arg_0, **arg_1):
        """
        Calculate the material physical property at the specified temperature
        in the units specified by the object's 'property_units' property.

        :param T: [K] temperature

        :returns: physical property value
        """
        super().Func(**arg_1)
        return np.polyval(arg_0._coeffs, arg_1['T'])


def Func(arg_0, arg_1):
        ''' Returns the data Func for the table. '''

        for arg_2 in arg_0._data:
            yield [
                arg_0.cell_text(arg_1, arg_3, arg_4)
                for arg_3, arg_4 in enumerate(arg_2)
            ]


def Func(arg_0, arg_1):
        ''' Renders the reports based on data.content_type's value.

        Arguments:
            data (ReportViewRequestData): The report data. data.content_type
                is used to determine how the reports are rendered.

        Returns:
            HTTPResponse: The rendered version of the report.

        '''
        arg_2 = {
            "text/csv": arg_0._render_as_csv,
            "text/html": arg_0._render_as_html,
            None: arg_0._render_as_html,
        }
        Func = arg_2[arg_1.content_type]
        return Func(arg_1)


def Func(arg_0):
    ''' Lists all of the reports currently available. '''

    arg_1 = []

    for arg_2 in get_all_reports():
        arg_1.append({
            "name": arg_2.__name__,
            "url": reverse(arg_2),
            "description": arg_2.__doc__,
        })

    arg_1.sort(key=lambda arg_2: arg_2["name"])

    arg_3 = {
        "reports": arg_1,
    }

    return render(arg_0, "registrasion/Func.html", arg_3)


def Func():
    ''' Summarises the items sold and discounts granted for a given set of
    products, or products from categories. '''

    arg_0 = None
    arg_1 = None

    arg_2 = commerce.LineItem.objects.filter(
        invoice__status=commerce.Invoice.STATUS_PAID,
    ).select_related("invoice")

    arg_2 = arg_2.order_by(
        # sqlite requires an order_by for .values() to work
        "-price", "description",
    ).values(
        "price", "description",
    ).annotate(
        total_quantity=Sum("quantity"),
    )

    arg_1 = ["Description", "Quantity", "Price", "Total"]

    arg_0 = []
    arg_3 = 0
    for arg_4 in arg_2:
        arg_5 = arg_4["total_quantity"] * arg_4["price"]
        arg_0.append([
            arg_4["description"], arg_4["total_quantity"],
            arg_4["price"], arg_5,
        ])
        arg_3 += arg_5

    arg_0.append([
        "(TOTAL)", "--", "--", arg_3,
    ])

    return ListReport("Items sold", arg_1, arg_0)


def Func():
    ''' Summarises paid items and payments. '''

    def value_or_zero(arg_0, arg_1):
        return arg_0[arg_1] or 0

    def sum_amount(arg_2):
        arg_3 = arg_2.values("amount").aggregate(total=Sum("amount"))
        return value_or_zero(arg_3, "total")

    arg_4 = ["Category", "Total"]
    arg_5 = []

    # Summarise all sales made (= income.)
    arg_6 = commerce.LineItem.objects.filter(
        invoice__status=commerce.Invoice.STATUS_PAID,
    ).values(
        "price", "quantity"
    ).aggregate(
        total=Sum(F("price") * F("quantity"), output_field=CURRENCY()),
    )
    arg_6 = value_or_zero(arg_6, "total")

    arg_7 = sum_amount(commerce.PaymentBase.objects.all())

    # Manual payments
    # Credit notes generated (total)
    # Payments made by credit note
    # Claimed credit notes

    arg_8 = 0 - sum_amount(commerce.CreditNote.objects.all())
    arg_9 = 0 - sum_amount(commerce.CreditNote.unclaimed())
    arg_10 = sum_amount(
        commerce.CreditNoteApplication.objects.all()
    )
    arg_11 = 0 - sum_amount(commerce.CreditNote.refunded())

    arg_5.append(["Items on paid invoices", arg_6])
    arg_5.append(["All payments", arg_7])
    arg_5.append(["Sales - Payments ", arg_6 - arg_7])
    arg_5.append(["All credit notes", arg_8])
    arg_5.append(["Credit notes paid on invoices", arg_10])
    arg_5.append(["Credit notes refunded", arg_11])
    arg_5.append(["Unclaimed credit notes", arg_9])
    arg_5.append([
        "Credit notes - (claimed credit notes + unclaimed credit notes)",
        arg_8 - arg_10 -
        arg_11 - arg_9
        ])

    return ListReport("Sales and Payments Summary", arg_4, arg_5)


def Func():
    ''' Shows the history of payments into the system '''

    Func = commerce.PaymentBase.objects.all()
    return QuerysetReport(
        "Payments",
        ["invoice__id", "id", "reference", "amount"],
        Func,
        link_view=views.invoice,
    )


def Func(arg_0, arg_1):
    ''' Summarises the usage of a given discount. '''

    arg_2 = arg_1.cleaned_data["discount"]

    arg_3 = commerce.DiscountItem.objects.filter(
        Q(discount__in=arg_2),
    ).select_related("cart", "product", "product__category")

    arg_3 = group_by_cart_status(
        arg_3,
        ["discount"],
        ["discount", "discount__description"],
    )

    arg_4 = [
        "Discount", "Paid", "Reserved", "Unreserved", "Refunded",
    ]
    arg_5 = []

    for arg_6 in arg_3:
        arg_5.append([
            arg_6["discount__description"],
            arg_6["total_paid"],
            arg_6["total_reserved"],
            arg_6["total_unreserved"],
            arg_6["total_refunded"],
        ])

    return ListReport("Usage by item", arg_4, arg_5)


def Func(arg_0, arg_1):
    ''' Shows each product line item from invoices, including their date and
    purchashing customer. '''

    arg_2 = arg_1.cleaned_data["product"]
    arg_3 = arg_1.cleaned_data["category"]

    arg_4 = commerce.Invoice.objects.filter(
        (
            Q(lineitem__product__in=arg_2) |
            Q(lineitem__product__category__in=arg_3)
        ),
        status=commerce.Invoice.STATUS_PAID,
    ).select_related(
        "cart",
        "user",
        "user__attendee",
        "user__attendee__attendeeprofilebase"
    ).order_by("issue_time")

    arg_5 = [
        'Invoice', 'Invoice Date', 'Attendee', 'Qty', 'Product', 'Status'
    ]

    arg_6 = []
    for arg_7 in arg_4:
        for arg_8 in arg_7.cart.productitem_set.all():
            if arg_8.product in arg_2 or arg_8.product.category in arg_3:
                arg_9 = []
                arg_9.append(arg_7.id)
                arg_9.append(arg_7.issue_time.strftime('%Y-%m-%d %H:%M:%S'))
                arg_9.append(
                    arg_7.user.attendee.attendeeprofilebase.attendee_name()
                )
                arg_9.append(arg_8.quantity)
                arg_9.append(arg_8.product)
                arg_10 = arg_7.cart
                if arg_10.status == commerce.Cart.STATUS_PAID:
                    arg_9.append('PAID')
                elif arg_10.status == commerce.Cart.STATUS_ACTIVE:
                    arg_9.append('UNPAID')
                elif arg_10.status == commerce.Cart.STATUS_RELEASED:
                    arg_9.append('REFUNDED')
                arg_6.append(arg_9)

    return ListReport("Line Items", arg_5, arg_6)


def Func(arg_0, arg_1):
    ''' Shows the number of paid invoices containing given products or
    categories per day. '''

    arg_2 = arg_1.cleaned_data["product"]
    arg_3 = arg_1.cleaned_data["category"]

    arg_4 = commerce.Invoice.objects.filter(
        (
            Q(lineitem__product__in=arg_2) |
            Q(lineitem__product__category__in=arg_3)
        ),
        status=commerce.Invoice.STATUS_PAID,
    )

    # Invoices with payments will be paid at the time of their latest payment
    arg_5 = commerce.PaymentBase.objects.all()
    arg_5 = arg_5.filter(
        invoice__in=arg_4,
    )
    arg_5 = arg_5.order_by("invoice")
    arg_6 = arg_5.values("invoice").annotate(
        max_time=Max("time")
    )

    # Zero-value invoices will have no payments, so they're paid at issue time
    arg_7 = arg_4.filter(value=0)

    arg_8 = itertools.chain(
        (line["max_time"] for line in arg_6),
        (invoice.issue_time for invoice in arg_7),
    )

    arg_9 = collections.defaultdict(int)
    for arg_10 in arg_8:
        arg_11 = datetime.datetime(
            year=arg_10.year, month=arg_10.month, day=arg_10.day
        )
        arg_9[arg_11] += 1

    arg_12 = [(date_, count) for date_, count in sorted(arg_9.items())]
    arg_12 = [(date_.strftime("%Y-%m-%d"), count) for date_, count in arg_12]

    return ListReport(
        "Paid Invoices By Date",
        ["date", "count"],
        arg_12,
    )


def Func(arg_0, arg_1):
    ''' Shows all of the invoices in the system. '''

    Func = commerce.Invoice.objects.all().order_by("status", "id")

    return QuerysetReport(
        "Invoices",
        ["id", "recipient", "value", "get_status_display"],
        Func,
        headings=["id", "Recipient", "Value", "Status"],
        link_view=views.invoice,
    )


def Func(arg_0, arg_1):
    ''' Shows registration status for speakers with a given proposal kind. '''

    arg_2 = arg_1.cleaned_data["kind"]

    arg_3 = schedule_models.Presentation.objects.filter(
        proposal_base__kind__in=arg_2,
    ).exclude(
        cancelled=True,
    )

    arg_4 = User.objects.filter(
        Q(speaker_profile__presentations__in=arg_3) |
        Q(speaker_profile__copresentations__in=arg_3)
    )

    arg_5 = commerce.Cart.objects.filter(status=commerce.Cart.STATUS_PAID)

    arg_5 = Case(
        When(cart__in=arg_5, then=Value(1)),
        default=Value(0),
        output_field=models.IntegerField(),
    )
    arg_4 = arg_4.annotate(arg_5=Sum(arg_5))
    arg_4 = arg_4.order_by("paid_carts")

    return QuerysetReport(
        "Speaker Registration Status",
        ["id", "speaker_profile__name", "email", "paid_carts"],
        arg_4,
        link_view=attendee,
    )

    return []


def Func(arg_0, arg_1, arg_2=None):
        """
        Create a sub component in the business component.

        :param name: The new component's name.
        :param description: The new component's description.

        :returns: The created component.
        """

        arg_3 = Component(arg_1, arg_0.gl, arg_2=arg_2)
        arg_3.set_parent_path(arg_0.path)
        arg_0.components.append(arg_3)
        return arg_3


def Func(arg_0, arg_1):
        """
        Remove a sub component from the component.

        :param name: The name of the component to remove.
        """

        arg_2 = None
        for arg_3 in arg_0.components:
            if arg_3.name == arg_1:
                arg_2 = arg_3
        if arg_2 is not None:
            arg_0.components.remove(arg_2)


def Func(arg_0, arg_1):
        """
        Retrieve a child component given its name.

        :param name: The name of the component.

        :returns: The component.
        """

        return [arg_2 for arg_2 in arg_0.components if arg_2.name == arg_1][0]


def Func(arg_0, arg_1):
        """
        Execute the entity at the current clock cycle.

        :param clock: The clock containing the current execution time and
          period information.
        """

        if arg_1.timestep_ix >= arg_0.period_count:
            return

        for arg_2 in arg_0.components:
            arg_2.Func(arg_1, arg_0.gl)

        arg_0._perform_year_end_procedure(arg_1)