def resolve_name(name):
    """
    Resolve a dotted name to some object (usually class, module, or function).

    Supported naming formats include:
        1. path.to.module:method
        2. path.to.module.ClassName

    >>> resolve_name('coilmq.store.memory.MemoryQueue')
    <class 'coilmq.store.memory.MemoryQueue'>
    >>> t = resolve_name('coilmq.store.dbm.make_dbm')
    >>> import inspect
    >>> inspect.isfunction(t)
    True
    >>> t.__name__
    'make_dbm'

    @param name: The dotted name (e.g. path.to.MyClass)
    @type name: C{str}

    @return: The resolved object (class, callable, etc.) or None if not found.
    """
    if ':' in name:
        # Normalize foo.bar.baz:main to foo.bar.baz.main
        # (since our logic below will handle that)
        name = '%s.%s' % tuple(name.split(':'))

    name = name.split('.')

    used = name.pop(0)
    found = __import__(used)
    for n in name:
        used = used + '.' + n
        try:
            found = getattr(found, n)
        except AttributeError:
            __import__(used)
            found = getattr(found, n)

    return found