docs: def hydrate_input_references(input_, input_schema, hydrate_values=True):
      """Hydrate ``input_`` with linked data.
  
      Find fields with complex data:<...> types in ``input_``.
      Assign an output of corresponding data object to those fields.
  
      """
      from .data import Data  # prevent circular import
  
      for field_schema, fields in iterate_fields(input_, input_schema):
          name = field_schema['name']
          value = fields[name]
          if 'type' in field_schema:
              if field_schema['type'].startswith('data:'):
                  if value is None:
                      continue
  
                  try:
                      data = Data.objects.get(id=value)
                  except Data.DoesNotExist:
                      fields[name] = {}
                      continue
  
                  output = copy.deepcopy(data.output)
                  if hydrate_values:
                      _hydrate_values(output, data.process.output_schema, data)
                  output["__id"] = data.id
                  output["__type"] = data.process.type
                  output["__descriptor"] = data.descriptor
                  output["__entity_name"] = None
                  output["__output_schema"] = data.process.output_schema
  
                  entity = data.entity_set.values('name').first()
                  if entity:
                      output["__entity_name"] = entity['name']
  
                  fields[name] = output
  
              elif field_schema['type'].startswith('list:data:'):
                  outputs = []
                  for val in value:
                      if val is None:
                          continue
  
                      try:
                          data = Data.objects.get(id=val)
                      except Data.DoesNotExist:
                          outputs.append({})
                          continue
  
                      output = copy.deepcopy(data.output)
                      if hydrate_values:
                          _hydrate_values(output, data.process.output_schema, data)
  
                      output["__id"] = data.id
                      output["__type"] = data.process.type
                      output["__descriptor"] = data.descriptor
                      output["__output_schema"] = data.process.output_schema
  
                      entity = data.entity_set.values('name').first()
                      if entity:
                          output["__entity_name"] = entity['name']
  
                      outputs.append(output)
  
                  fields[name] = outputs