import ntpath


def path_base_and_leaf(path):
    """
    Splits path to a base part and a file or directory name, as in the following example:
    path: '/a/b'; base: '/a'; leaf: 'b'
    """
    head, tail = ntpath.split(path)
    if not tail:  # in case there is trailing slash at the end of path
        return {'base': ntpath.split(head)[0], 'leaf': ntpath.basename(head)}
    return {'base': head, 'leaf': tail}