def lookup_in_namespace(name,namespace):
    """Resolve a dotted name into an object, using given namespace."""
    bits = name.split(".")
    obj = namespace[bits[0]]
    for attr in bits[1:]:
        obj = getattr(obj,attr)
    return obj