def parse_gpx(gpx_element, gpx_extensions_parser=None,<EOL>metadata_extensions_parser=None,<EOL>waypoint_extensions_parser=None,<EOL>route_extensions_parser=None,<EOL>track_extensions_parser=None,<EOL>segment_extensions_parser=None,<EOL>gpxns=None):
gpxns = gpxns if gpxns is not None else determine_gpx_namespace(gpx_element)<EOL>if gpx_element.tag != gpxns+'<STR_LIT>':<EOL><INDENT>raise ValueError("<STR_LIT>")<EOL><DEDENT>creator = gpx_element.attrib['<STR_LIT>']<EOL>version = gpx_element.attrib['<STR_LIT:version>']<EOL>if not version.startswith('<STR_LIT>'):<EOL><INDENT>raise ValueError("<STR_LIT>")<EOL><DEDENT>metadata_element = gpx_element.find(gpxns+'<STR_LIT>')<EOL>metadata = nullable(parse_metadata)(metadata_element, gpxns)<EOL>waypoint_elements = gpx_element.findall(gpxns+'<STR_LIT>')<EOL>waypoints = [parse_waypoint(waypoint_element, gpxns) for waypoint_element in waypoint_elements]<EOL>route_elements = gpx_element.findall(gpxns+'<STR_LIT>')<EOL>routes = [parse_route(route_element, gpxns) for route_element in route_elements]<EOL>track_elements = gpx_element.findall(gpxns+'<STR_LIT>')<EOL>tracks = [parse_track(track_element, gpxns) for track_element in track_elements]<EOL>extensions_element = gpx_element.find(gpxns+'<STR_LIT>')<EOL>extensions = nullable(parse_gpx_extensions)(extensions_element, gpxns)<EOL>gpx_model = GpxModel(creator, metadata, waypoints, routes, tracks,<EOL>extensions)<EOL>return gpx_model<EOL>
Parse a GPX file into a GpxModel.

    Args:
        gpx_element: gpx_element: The root <gpx> element of an XML document
            containing a version attribute. GPX versions 1.1 is supported.

        gpx_extensions_parser: An optional callable which accepts an Element
            with the 'extensions' tag and returns a list of model objects
            representing the extensions. If not specified, extensions are
            ignored.

        metadata_extensions_parser: An optional callable which accepts an
            Element with the 'extensions' tag and returns a list of model
            objects representing the extensions. If not specified, extensions
            are ignored.

        waypoint_extensions_parser: An optional callable which accepts an
            Element with the 'extensions' tag and returns a list of model
            objects representing the extensions. If not specified, extensions
            are ignored.

        route_extensions_parser: An optional callable which accepts an Element
            with the 'extensions' tag and returns a list of model objects
            representing the extensions. If not specified, extensions are
            ignored.

        track_extensions_parser: An optional callable which accepts an Element
            with the 'extensions' tag and returns a list of model objects
            representing the extensions. If not specified, extensions are
            ignored.

        segment_extensions_parser: An optional callable which accepts an
            Element with the 'extensions' tag and returns a list of model
            objects representing the extensions. If not specified, extensions
            are ignored.


    Returns:
        A GpxModel representing the data from the supplies xml.

    Raises:
        ValueError: The supplied XML could not be parsed as GPX.