def file_in_confined_directories(filepath, confined_directories):
<EOL>securesystemslib.formats.RELPATH_SCHEMA.check_match(filepath)<EOL>securesystemslib.formats.RELPATHS_SCHEMA.check_match(confined_directories)<EOL>for confined_directory in confined_directories:<EOL><INDENT>if confined_directory == '<STR_LIT>':<EOL><INDENT>return True<EOL><DEDENT>filepath = os.path.normpath(filepath)<EOL>confined_directory = os.path.normpath(confined_directory)<EOL>if os.path.dirname(filepath) == confined_directory:<EOL><INDENT>return True<EOL><DEDENT><DEDENT>return False<EOL>
<Purpose>
  Check if the directory containing 'filepath' is in the list/tuple of
  'confined_directories'.

<Arguments>
  filepath:
    A string representing the path of a file.  The following example path
    strings are viewed as files and not directories: 'a/b/c', 'a/b/c.txt'.

  confined_directories:
    A list, or a tuple, of directory strings.

<Exceptions>
 securesystemslib.exceptions.FormatError: On incorrect format of the input.

<Return>
  Boolean.  True, if path is either the empty string
  or in 'confined_paths'; False, otherwise.