def do_with_file(path, action):
    """Do some *action* with an file opened with path.
    
    Parameters:
        path (str): Path of the file
        action (callable): A callable with a file descriptor as first argument.
    
    Returns:
        The return value of *action*
    """
    with open(path, encoding='utf8') as this_file:
        return action(this_file)
