<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 def dist_to_req(dist):
 """Make a pip.FrozenRequirement from a pkg_resources distribution object"""

    try:  # :pragma:nocover: (pip>=10)
        from pip._internal.operations.freeze import FrozenRequirement
    except ImportError:  # :pragma:nocover: (pip<10)
        from pip import FrozenRequirement

    # normalize the casing, dashes in the req name
    orig_name, dist.project_name = dist.project_name, dist.key
    result = FrozenRequirement.from_dist(dist, [])
    # put things back the way we found it.
    dist.project_name = orig_name

    return result