code: def is_directory(self):
          
          if self.cid is None:
              msg = 'Cannot determine whether this task is a directory.'
              if not self.is_transferred:
                  msg += ' This task has not been transferred.'
              raise TaskError(msg)
          return self.api.downloads_directory.cid != self.cid
docs: :return: whether this task is associated with a directory.
          :rtype: bool