def _get_rename_function(mapper):
if isinstance(mapper, (abc.Mapping, ABCSeries)):<EOL><INDENT>def f(x):<EOL><INDENT>if x in mapper:<EOL><INDENT>return mapper[x]<EOL><DEDENT>else:<EOL><INDENT>return x<EOL><DEDENT><DEDENT><DEDENT>else:<EOL><INDENT>f = mapper<EOL><DEDENT>return f<EOL>
Returns a function that will map names/labels, dependent if mapper
is a dict, Series or just a function.