'Splits the extension from the given path.
The given path is first normalized (e.g. possible trailing
path separators removed, special directories ``..`` and ``.``
removed). The base path and extension are returned as separate
components so that the dot used as an extension separator is
removed. If the path contains no extension, an empty string is
returned for it. Possible leading and trailing dots in the file
name are never considered to be extension separators.
Examples:
| ${path} | ${ext} = | Split Extension | file.extension    |
| ${p2}   | ${e2} =  | Split Extension | path/file.ext     |
| ${p3}   | ${e3} =  | Split Extension | path/file         |
| ${p4}   | ${e4} =  | Split Extension | p1/../p2/file.ext |
| ${p5}   | ${e5} =  | Split Extension | path/.file.ext    |
| ${p6}   | ${e6} =  | Split Extension | path/.file        |
- ${path} = \'file\' & ${ext} = \'extension\'
- ${p2} = \'path/file\' & ${e2} = \'ext\'
- ${p3} = \'path/file\' & ${e3} = \'\'
- ${p4} = \'p2/file\' & ${e4} = \'ext\'
- ${p5} = \'path/.file\' & ${e5} = \'ext\'
- ${p6} = \'path/.file\' & ${e6} = \'\''

def split_extension(self, path):

    path = self.normalize_path(path)
    basename = os.path.basename(path)
    if basename.startswith(('.' * basename.count('.'))):
        return (path, '')
    if path.endswith('.'):
        path2 = path.rstrip('.')
        trailing_dots = ('.' * (len(path) - len(path2)))
        path = path2
    else:
        trailing_dots = ''
    (basepath, extension) = os.path.splitext(path)
    if extension.startswith('.'):
        extension = extension[1:]
    if extension:
        extension += trailing_dots
    else:
        basepath += trailing_dots
    return (basepath, extension)
