<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 def get_package_hashes( package, version=None, algorithm=DEFAULT_ALGORITHM, python_versions=(), verbose=False, include_prereleases=False, lookup_memory=None, index_url=DEFAULT_INDEX_URL, ):
 """ Gets the hashes for the given package. { 'package': 'hashin', 'version': '0.10', 'hashes': [ { }, { }, { } ] } """

    if lookup_memory is not None and package in lookup_memory:
        data = lookup_memory[package]
    else:
        data = get_package_data(package, index_url, verbose)
    if not version:
        version = get_latest_version(data, include_prereleases)
        assert version
        if verbose:
            _verbose("Latest version for {0} is {1}".format(package, version))

    # Independent of how you like to case type it, pick the correct
    # name from the PyPI index.
    package = data["info"]["name"]

    try:
        releases = data["releases"][version]
    except KeyError:
        raise PackageError("No data found for version {0}".format(version))

    if python_versions:
        releases = filter_releases(releases, python_versions)

    if not releases:
        if python_versions:
            raise PackageError(
                "No releases could be found for "
                "{0} matching Python versions {1}".format(version, python_versions)
            )
        else:
            raise PackageError("No releases could be found for {0}".format(version))

    hashes = list(
        get_releases_hashes(releases=releases, algorithm=algorithm, verbose=verbose)
    )
    return {"package": package, "version": version, "hashes": hashes}