def import_module(conf):
    """
    Imports the configuration as a module.

    :param conf: The string to the configuration.
    Automatically strips off ".py" file extensions.
    """
    if '.' in conf:
        parts = conf.split('.')
        name = '.'.join(parts[:-1])
        fromlist = parts[-1:]
        try:
            module = __import__(name, fromlist=fromlist)
            conf_mod = getattr(module, parts[-1])
        except AttributeError:
            raise ImportError('No module named %s' % conf)
    else:
        conf_mod = __import__(conf)
    return conf_mod
