<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 def map(self, mapper: Callable[[Any], Any]) -> 'List': """Map a function over a List."""

        try:
            ret = List.from_iterable([mapper(x) for x in self])
        except TypeError:
            ret = List.from_iterable([partial(mapper, x) for x in self])
        return ret