code: def mapped(cls, key='id', **kwargs):
      
      kwargs.setdefault('metadata', {})
      kwargs['metadata']['jsonldPredicate'] = {'mapSubject': key}
      kwargs.setdefault('default', attr.Factory(list))
  
      def converter(value):
          """Convert mapping to a list of instances."""
          if isinstance(value, dict):
              result = []
              for k, v in iteritems(value):
                  if not hasattr(cls, 'from_cwl'):
                      vv = dict(v)
                      vv[key] = k
                  else:
                      vv = attr.evolve(cls.from_cwl(v), **{key: k})
                  result.append(vv)
          else:
              result = value
  
          def fix_keys(data):
              """Fix names of keys."""
              for a in fields(cls):
                  a_name = a.name.rstrip('_')
                  if a_name in data:
                      yield a.name, data[a_name]
  
          return [
              cls(**{kk: vv
                     for kk, vv in fix_keys(v)}) if not isinstance(v, cls) else v
              for v in result
          ]
  
      kwargs['converter'] = converter
      return attr.ib(**kwargs)
docs: Create list of instances from a mapping.