<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_url(url, extra_schemes={}):
 """ parse a munge url type:URL URL.type examples: file.yaml yaml:file.txt http://example.com/file.yaml yaml:http://example.com/file.txt mysql://user:password@localhost/database/table django:///home/user/project/settings_dir.settings/app_name/model """


    if not url:
        raise ValueError('url cannot be empty')

    cls = None
    res = urlsplit(url)

    # check config first
    if res.scheme in extra_schemes:
        # TODO - nerge these with any existing and recurse
        addr = extra_schemes[res.scheme]
        if 'type' in addr:
            cls = find_cls(res.scheme, extra_schemes)
        if 'url' in addr:
            url = addr['url']
            if cls:
                res = urlsplit(url)
                return MungeURL(cls, res)
            # TODO - nerge these with any existing and recurse
            return parse_url(url)

    if res.scheme:
        cls = find_cls(res.scheme, extra_schemes)

    # check file extension
    if not cls:
        (rest, sep, ext) = url.rpartition('.')
        cls = find_cls(ext, extra_schemes)

        if not cls:
            raise ValueError('unable to find codec for %s' % url)

    return MungeURL(cls, res)