docs: def assign_fields(meta, assignments):
      """ Takes a list of C{key=value} strings and assigns them to the
          given metafile. If you want to set nested keys (e.g. "info.source"),
          you have to use a dot as a separator. For exotic keys *containing*
          a dot, double that dot ("dotted..key").
  
          Numeric values starting with "+" or "-" are converted to integers.
  
          If just a key name is given (no '='), the field is removed.
      """
      for assignment in assignments:
          assignment = fmt.to_unicode(assignment)
          try:
              if '=' in assignment:
                  field, val = assignment.split('=', 1)
              else:
                  field, val = assignment, None
  
              if val and val[0] in "+-" and val[1:].isdigit():
                  val = int(val, 10)
  
              # TODO: Allow numerical indices, and "+" for append
              namespace = meta
              keypath = [i.replace('\0', '.') for i in field.replace('..', '\0').split('.')]
              for key in keypath[:-1]:
                  # Create missing dicts as we go...
                  namespace = namespace.setdefault(fmt.to_utf8(key), {})
          except (KeyError, IndexError, TypeError, ValueError) as exc:
              if self.options.debug:
                  raise
              raise error.UserError("Bad assignment %r (%s)!" % (assignment, exc))
          else:
              if val is None:
                  del namespace[fmt.to_utf8(keypath[-1])]
              else:
                  namespace[fmt.to_utf8(keypath[-1])] = fmt.to_utf8(val)
  
      return meta