def filter_by_startswith(seq, chars):
    """A generator that filters ``seq`` such that every element in ``seq``
    begins with ``chars``.
    """
    return (elem for elem in seq if elem.startswith(chars))