<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 def get_pkg_version_module(packagename, fromlist=None):
 """Returns the package's .version module generated by `astropy_helpers.version_helpers.generate_version_py`. Raises an ImportError if the version module is not found. If ``fromlist`` is an iterable, return a tuple of the members of the version module corresponding to the member names given in ``fromlist``. Raises an `AttributeError` if any of these module members are not found. """


    version = import_file(os.path.join(packagename, 'version.py'), name='version')

    if fromlist:
        return tuple(getattr(version, member) for member in fromlist)
    else:
        return version