def escape_path(path):
    """
    Adds " if the path contains whitespaces

    Parameters
    ----------
        path: str
            A path to a file.

    Returns
    -------
        an escaped path
    """
    if ' ' in path and not (path.startswith('"') and path.endswith('"')):
        return '"' + path + '"'
    else:
        return path