Determines the python package path based on the inputted path.
    
    :param      path | <str>
    
    :return     <str>

def packageFromPath(path, includeModule=False):
    """
    Determines the python package path based on the inputted path.
    
    :param      path | <str>
    
    :return     <str>
    """
    path = nstr(path)
    module = ''
    if os.path.isfile(path):
        path, fname = os.path.split(path)
        if fname.endswith('.py') and fname != '__init__.py':
            module = fname.split('.')[0]

    parts = os.path.normpath(path).split(os.path.sep)
    package_parts = []

    for i in range(len(parts), 0, -1):
        filename = os.path.sep.join(parts[:i] + ['__init__.py'])

        if not os.path.isfile(filename):
            break

        package_parts.insert(0, parts[i - 1])

    if includeModule and module:
        package_parts.append(module)

    return '.'.join(package_parts)