def packages_to_dict(request, packages):
    """ Convert a list of packages to a dict used by the template """
    pkgs = {}
    for package in packages:
        pkgs[package.filename] = {'url': package.get_url(request),
            'requires_python': package.data.get('requires_python')}
    return pkgs
