'Gets the path of a Python package'

def _get_package_paths(self, subdirs=True):

    if (not self.package):
        return []
    if (not hasattr(self, 'package_path')):
        m = __import__(self.package)
        parts = self.package.split('.')[1:]
        for parent_mod in parts:
            m = getattr(m, parent_mod)
        self.package_path = os.path.dirname(m.__file__)
    if subdirs:
        return self._all_directories(self.package_path)
    return [self.package_path]
