from typing import Callable
from typing import Iterable


def sort_by(key: Callable):
    """Return a new list containing all items from the iterable in ascending order, sorted by a key.
    >>> sort_by(len)(["hi!", "my", "name", "is"])
    ['my', 'is', 'hi!', 'name']
    """

    def sort_by(seq: Iterable):
        return sorted(seq, key=key)

    return sort_by