'Attempt to determine app\'s filesystem path from its module.'

def _path_from_module(self, module):

    paths = list(getattr(module, '__path__', []))
    if (len(paths) != 1):
        filename = getattr(module, '__file__', None)
        if (filename is not None):
            paths = [os.path.dirname(filename)]
        else:
            paths = list(set(paths))
    if (len(paths) > 1):
        raise ImproperlyConfigured(("The    app    module    %r    has    multiple    filesystem    locations    (%r);    you    must    configure    this    app    with    an    AppConfig    subclass    with    a    'path'    class    attribute." % (module, paths)))
    elif (not paths):
        raise ImproperlyConfigured(("The    app    module    %r    has    no    filesystem    location,    you    must    configure    this    app    with    an    AppConfig    subclass    with    a    'path'    class    attribute." % (module,)))
    return paths[0]
