import six


def get_apt_preferences_line(deb_release):
    """Get an APT Preferences line from repo's release information.

    :param deb_release: a Debian's Release content as dict
    :returns: an apt pinning line as string
    """
    _transformations = {
        'Archive': 'a',
        'Suite': 'a',       # suite is a synonym for archive
        'Codename': 'n',
        'Version': 'v',
        'Origin': 'o',
        'Label': 'l',
    }

    conditions = set()
    for field, condition in six.iteritems(_transformations):
        if field in deb_release:
            conditions.add('{0}={1}'.format(condition, deb_release[field]))

    return ','.join(conditions)