@transformer<EOL>def copy(input, **params):
PARAM_FIELDS = '<STR_LIT>'<EOL>def filter_fields(obj, fields):<EOL><INDENT>return {k:v for k,v in obj.items() if k in fields}<EOL><DEDENT>if PARAM_FIELDS in params:<EOL><INDENT>fields = params.get(PARAM_FIELDS)<EOL>if isinstance(input, list):<EOL><INDENT>res = []<EOL>for row in input:<EOL><INDENT>res.append(filter_fields(row, fields))<EOL><DEDENT>return res<EOL><DEDENT>elif isinstance(input, dict):<EOL><INDENT>return filter_fields(input, fields)<EOL><DEDENT>else:<EOL><INDENT>raise NotImplementedError('<STR_LIT>'.format(type(input)))<EOL><DEDENT><DEDENT>else:<EOL><INDENT>return input<EOL><DEDENT>
Copies input or input's selected fields
:param input:
:param params:
:return: input