def _parse_tuple(element, definition, required):
<EOL>d_len = len(definition)<EOL>if d_len == <NUM_LIT:0>:<EOL><INDENT>return None<EOL><DEDENT>if d_len == <NUM_LIT:1>:<EOL><INDENT>return xml_to_json(element, definition[<NUM_LIT:0>], required)<EOL><DEDENT>first = definition[<NUM_LIT:0>]<EOL>if hasattr(first, '<STR_LIT>'):<EOL><INDENT>return first(*[xml_to_json(element, d) for d in definition[<NUM_LIT:1>:]])<EOL><DEDENT>if not isinstance(first, str):<EOL><INDENT>raise XmlToJsonException('<STR_LIT>')<EOL><DEDENT>if first[<NUM_LIT:0>] == '<STR_LIT:@>':<EOL><INDENT>raise XmlToJsonException('<STR_LIT>')<EOL><DEDENT>sub_elem = element.find(first)<EOL>if sub_elem is None:<EOL><INDENT>if required:<EOL><INDENT>raise NotCompleteXmlException('<STR_LIT>'.format(first, element.tag))<EOL><DEDENT>return None<EOL><DEDENT>return xml_to_json(sub_elem, definition[<NUM_LIT:1>], required)<EOL>
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