<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 def _validate_file_mode(mode, file_name, optional=False):
 """ Validate that a specified file has the specified permissions. :param mode: file mode that is desires :type owner: str :param file_name: Path to the file to verify :type file_name: str :param optional: Is this file optional, ie: Should this test fail when it's missing :type optional: bool """

    try:
        ownership = _stat(file_name)
    except subprocess.CalledProcessError as e:
        print("Error reading file: {}".format(e))
        if not optional:
            assert False, "Specified file does not exist: {}".format(file_name)
    assert mode == ownership.mode, \
        "{} has an incorrect mode: {} should be {}".format(
            file_name, ownership.mode, mode)
    print("Validate mode of {}: PASS".format(file_name))