def select(items, container, *, ctor=None):
    """
    Returns `items` that are in `container`.

    :param ctor:
      Constructor for returned value.  If `None`, uses the type of `items`.
      Use `iter` to return an iterable.
    """
    if ctor is None:
        ctor = type(items)

    return ctor( i for i in items if i in container )