docs: def record_factory(app, fields=None):
      """Return a temporary Record instance to be used for field validation and value parsing
  
      Args:
          app (App): Target App to create a transient Record instance for
          fields (dict): Optional dict of fields and values to set on new Record instance before returning
  
      Returns:
          Record: Unsaved Record instance to be used for validation, creation, etc.
      """
      # pylint: disable=line-too-long
      record = Record(app, {
          '$type': Record._type,
          'isNew': True,
          'applicationId': app.id,
          'comments': {
              '$type': 'System.Collections.Generic.Dictionary`2[[System.String, mscorlib],[System.Collections.Generic.List`1[[Core.Models.Record.Comments, Core]], mscorlib]], mscorlib'
          },
          'values': {
              '$type': 'System.Collections.Generic.Dictionary`2[[System.String, mscorlib],[System.Object, mscorlib]], mscorlib'
          }
      })
  
      fields = fields or {}
  
      for name, value in six.iteritems(fields):
          record[name] = value
  
      # Pop off fields with None value to allow for saving empty fields
      copy_raw = copy.copy(record._raw)
      values_dict = {}
      for key, value in six.iteritems(copy_raw['values']):
          if value is not None:
              values_dict[key] = value
      record._raw['values'] = values_dict
  
      return record