<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 def _parse_tuple(element, definition, required):
 """Parse xml element by a definition given in tuple format. :param element: ElementTree element :param definition: definition schema :type definition: tuple :param required: parsed value should be not None :type required: bool :return: parsed xml """

    # TODO needs to be documented properly.
    d_len = len(definition)

    if d_len == 0:
        return None
    if d_len == 1:
        return xml_to_json(element, definition[0], required)

    first = definition[0]

    if hasattr(first, '__call__'):
        # TODO I think it could be done without creating the array
        # first(xml_to_json(element, d) for d in definition[1:]) test it
        return first(*[xml_to_json(element, d) for d in definition[1:]])

    if not isinstance(first, str):
        raise XmlToJsonException('Tuple definition must start with function or string')

    if first[0] == '@':
        raise XmlToJsonException('Tuple definition must not start with attribute')

    sub_elem = element.find(first)

    if sub_elem is None:
        if required:
            raise NotCompleteXmlException('Expecting {0} in element {1}'.format(first, element.tag))

        return None

    return xml_to_json(sub_elem, definition[1], required)