def _map_requirements(declared_dependencies, dependency_set):
    """Given the declared dependencies from requirements.txt and the given
    programmatic dependency set, return the subset of declared dependencies that
    matches the dependency set
    """
    return sorted(
        [
            declared_dependencies[dep.replace("-", "_")]
            for dep in dependency_set
            if dep.replace("-", "_") in declared_dependencies
        ]
    )