code: def copy(input, **params):
      
      PARAM_FIELDS = 'fields'
  
      def filter_fields(obj, fields):
          return {k:v for k,v in obj.items() if k in fields}
  
      if PARAM_FIELDS in params:
          fields = params.get(PARAM_FIELDS)
          if isinstance(input, list):
              res = []
              for row in input:
                  res.append(filter_fields(row, fields))
              return res
          elif isinstance(input, dict):
              return filter_fields(input, fields)
          else:
              raise NotImplementedError('{} is not supported'.format(type(input)))
      else:
          return input
docs: Copies input or input's selected fields
      :param input:
      :param params:
      :return: input