def asmodule(module):
    """
    Return the :class:`module` instance named by `module`.

    If `module` is already a module instance and not a string, return
    it unchanged.

    """
    if isinstance(module, str):
        module = __import__(module, fromlist=[])
    return module