def _tornado_import_object(name):
    """code from tornado.util.import_object"""
    name = str(name)
    if name.count('.') == 0:
        return __import__(name, None, None)
    parts = name.split('.')
    obj = __import__('.'.join(parts[:-1]), None, None, [parts[-1]], 0)
    try:
        return getattr(obj, parts[-1])
    except AttributeError:
        raise ImportError('No module named %s' % parts[-1])
