def filtertype(objtype, sequence, filterfalse=False):
    """filter a list of objects base on their type. Currently two types of filtering
    are allowed, those that have the same type as `objtype` and those that doesnt.
    `filterfalse` should be set to `True` if negative filtering is desired.

    Args:
        objtype (Any): Type of the objects that are used as comparison.
        sequence (Sequence[Any]): A sequence of objects to be filtered.
        filterfalse (Optional[bool]): whether or not to filter those objects that
          are not of type `objtype`.
    Returns:
        Iterator[Any]: iterator over the sequence of objects that conform to the
          desired filtering process.
    """
    filterfn = filter if not filterfalse else filterfalse
    return filterfn(lambda element: isinstance(element, objtype), sequence)
