'Return true if \'ext\' links to a dynamic lib in the same package'

def links_to_dynamic(self, ext):

    libnames = dict.fromkeys([lib._full_name for lib in self.shlibs])
    pkg = '.'.join((ext._full_name.split('.')[:(-1)] + ['']))
    for libname in ext.libraries:
        if ((pkg + libname) in libnames):
            return True
    return False
