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

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

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

  return bfs10103

