from os.path import abspath, isdir, dirname, basename, join, pardir
import pkgutil
def bfs10065(bfs10057):
  bfs10062 = pkgutil.get_loader(bfs10057)
  try:
    filename = bfs10062.filename
  except AttributeError:
    filename = bfs10062.get_filename(bfs10057)

  bfs10063 = abspath(dirname(filename))
  is_package = (basename(filename) in ('__init__.py', '__init__.pyc'))
  if is_package:
    bfs10063 = abspath(join(bfs10063, pardir))

  while (not isdir(bfs10063)):
    bfs10063 = abspath(join(bfs10063, pardir))

  return bfs10063

