docs: def encode_task(task):
      """ Convert a dict-like task to its string representation """
      # First, clean the task:
      task = task.copy()
      if 'tags' in task:
          task['tags'] = ','.join(task['tags'])
      for k in task:
          for unsafe, safe in six.iteritems(encode_replacements):
              if isinstance(task[k], six.string_types):
                  task[k] = task[k].replace(unsafe, safe)
  
          if isinstance(task[k], datetime.datetime):
              task[k] = task[k].strftime("%Y%m%dT%M%H%SZ")
  
      # Then, format it as a string
      return "[%s]\n" % " ".join([
          "%s:\"%s\"" % (k, v)
          for k, v in sorted(task.items(), key=itemgetter(0))
      ])