<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 def version_from_frame(frame):
 """ Given a ``frame``, obtain the version number of the module running there. """


    module = getmodule(frame)
    if module is None:
        s = "<unknown from {0}:{1}>"
        return s.format(frame.f_code.co_filename, frame.f_lineno)

    module_name = module.__name__

    variable = "AUTOVERSION_{}".format(module_name.upper())
    override = os.environ.get(variable, None)
    if override is not None:
        return override

    while True:
        try:
            get_distribution(module_name)
        except DistributionNotFound:
            # Look at what's to the left of "."
            module_name, dot, _ = module_name.partition(".")
            if dot == "":
                # There is no dot, nothing more we can do.
                break
        else:
            return getversion(module_name)

    return None