import imp


def is_module(name, path=None):
    """Check if exists a module with given name."""
    try:
        fp, _, _ = imp.find_module(name, path)
        if fp is not None:
            fp.close()
        return True
    except ImportError:
        return False