def split_path(path):
    """
    Splits the text and build a nice import statement from it.
    Note: only well defined import paths are supported. Not something invalid like '..foo.bar..'.


    >>> split_path('foo.bar.Batz')
    ('foo.bar', 'Batz')

    >>> split_path('..lel')
    ('..', 'lel')

    >>> split_path('.lul')
    ('.', 'lul')

    >>> split_path('lol')
    ('', 'lol')

    >>> split_path('...na.na.na.na.na.na.Batman')
    ('...na.na.na.na.na.na', 'Batman')

    >>> split_path('...........yolo.swagger')
    ('...........yolo', 'swagger')

    :param path: The path to split.
    :type  path: str

    :return: The import text, like `from x import y` or `import z`
    :rtype: tuple(str)|Tuple[str, str]
    """
    last_dot_position = path.rfind('.')
    if last_dot_position == -1:
        # no dot found.
        import_path = ''
        import_name = path
    else:
        import_path = path[:last_dot_position + 1]
        import_name = path[last_dot_position + 1:]

        # handle 'foo.bar.Baz' not resulting in 'foo.bar.', i.e. remove the dot at the end.
        if import_path.rstrip('.') != '':
            # e.g. not '....'
            import_path = import_path.rstrip('.')
    # end if

    return import_path, import_name