def get_canonical_name(value, strict=False):
    if not hasattr(value, '__name__'): return UNKNOWN

    # Get the name via introspection.
    if isinstance(value, ModuleType):
        try:
            dotted_name = DottedName(value.__name__, strict=strict)
            # If the module is shadowed by a variable in its parent
            # package(s), then add a prime mark to the end, to
            # differentiate it from the variable that shadows it.
            if verify_name(value, dotted_name) is UNKNOWN:
                log.warning("Module %s is shadowed by a variable with "
                            "the same name." % dotted_name)
                # Note -- this return bypasses verify_name check:
                return DottedName(value.__name__+"'")
        except DottedName.InvalidDottedName:
            # Name is not a valid Python identifier -- treat as script.
            if hasattr(value, '__file__'):
                filename = '%s' % value.__str__
                dotted_name = DottedName(munge_script_name(filename))
        
    elif isclass(value):
        if value.__module__ == '__builtin__':
            dotted_name = DottedName(value.__name__, strict=strict)
        else:
            dotted_name = DottedName(value.__module__, value.__name__,
                                     strict=strict)
            
    elif (inspect.ismethod(value) and value.im_self is not None and
          value.im_class is ClassType and
          not value.__name__.startswith('<')): # class method.
        class_name = get_canonical_name(value.im_self)
        if class_name is UNKNOWN: return UNKNOWN
        dotted_name = DottedName(class_name, value.__name__, strict=strict)
    elif (inspect.ismethod(value) and
          not value.__name__.startswith('<')):
        class_name = get_canonical_name(value.im_class)
        if class_name is UNKNOWN: return UNKNOWN
        dotted_name = DottedName(class_name, value.__name__, strict=strict)
    elif (isinstance(value, FunctionType) and
          not value.__name__.startswith('<')):
        module_name = _find_function_module(value)
        if module_name is None: return UNKNOWN
        dotted_name = DottedName(module_name, value.__name__, strict=strict)
    else:
        return UNKNOWN

    return verify_name(value, dotted_name)
Finalizes all pending transfers.
dataset/ETHPy150Open CollabQ/CollabQ/vendor/epydoc/docintrospecter.py/get_canonical_name--crossover with--dataset/ETHPy150Open ganeti/ganeti/lib/masterd/instance.py/ImportExportLoop.FinalizeAll