<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 def AddDirectory(self, path):
 """Adds a directory to the fake file system. Note that this function will create parent directories if needed. Args: path (str):
 path of the directory within the fake file system. Raises: ValueError: if the path is already set. """

    if self.file_system.FileEntryExistsByPath(path):
      raise ValueError('Path: {0:s} already set.'.format(path))

    self._AddParentDirectories(path)
    self.file_system.AddFileEntry(
        path, file_entry_type=definitions.FILE_ENTRY_TYPE_DIRECTORY)