def path2FormatPath(path, hasFormat=None):
    """Answers the path where the extension is changed to format If format is
    None, then the extension is removed."""
    if path is not None:
        path = '.'.join(path.split('.')[:-1])
        if hasFormat is not None:
            path += '.' + hasFormat
        return path
    return None