def unpack_file_url(<EOL>link,  <EOL>location,  <EOL>download_dir=None,  <EOL>hashes=None  <EOL>):<EOL>
link_path = url_to_path(link.url_without_fragment)<EOL>if is_dir_url(link):<EOL><INDENT>if os.path.isdir(location):<EOL><INDENT>rmtree(location)<EOL><DEDENT>shutil.copytree(link_path, location, symlinks=True)<EOL>if download_dir:<EOL><INDENT>logger.info('<STR_LIT>')<EOL><DEDENT>return<EOL><DEDENT>if hashes:<EOL><INDENT>hashes.check_against_path(link_path)<EOL><DEDENT>already_downloaded_path = None<EOL>if download_dir:<EOL><INDENT>already_downloaded_path = _check_download_dir(link,<EOL>download_dir,<EOL>hashes)<EOL><DEDENT>if already_downloaded_path:<EOL><INDENT>from_path = already_downloaded_path<EOL><DEDENT>else:<EOL><INDENT>from_path = link_path<EOL><DEDENT>content_type = mimetypes.guess_type(from_path)[<NUM_LIT:0>]<EOL>unpack_file(from_path, location, content_type, link)<EOL>if download_dir and not already_downloaded_path:<EOL><INDENT>_copy_file(from_path, download_dir, link)<EOL><DEDENT>
Unpack link into location.

    If download_dir is provided and link points to a file, make a copy
    of the link file inside download_dir.