def unpack_url(<EOL>link,  <EOL>location,  <EOL>download_dir=None,  <EOL>only_download=False,  <EOL>session=None,  <EOL>hashes=None,  <EOL>progress_bar="<STR_LIT>"  <EOL>):<EOL>
<EOL>if is_vcs_url(link):<EOL><INDENT>unpack_vcs_link(link, location)<EOL><DEDENT>elif is_file_url(link):<EOL><INDENT>unpack_file_url(link, location, download_dir, hashes=hashes)<EOL><DEDENT>else:<EOL><INDENT>if session is None:<EOL><INDENT>session = PipSession()<EOL><DEDENT>unpack_http_url(<EOL>link,<EOL>location,<EOL>download_dir,<EOL>session,<EOL>hashes=hashes,<EOL>progress_bar=progress_bar<EOL>)<EOL><DEDENT>if only_download:<EOL><INDENT>write_delete_marker_file(location)<EOL><DEDENT>
Unpack link.
       If link is a VCS link:
         if only_download, export into download_dir and ignore location
          else unpack into location
       for other types of link:
         - unpack into location
         - if download_dir, copy the file into download_dir
         - if only_download, mark location for deletion

    :param hashes: A Hashes object, one of whose embedded hashes must match,
        or HashMismatch will be raised. If the Hashes is empty, no matches are
        required, and unhashable types of requirements (like VCS ones, which
        would ordinarily raise HashUnsupported) are allowed.