def import_module(module):
    """Returns a module.

    For example, if you do import_module('foo.bar.baz'), it returns
    the 'baz' module instead of 'foo'.
    """
    m = __import__(module)
    for x in module.split('.'):
        m = getattr(m, x)
    return m
