def featuretype_filter(feature, featuretype):
    """Check if feature is a feature of interest (genes, CDSs and RNAs)."""
    if feature[2] == featuretype:
        return True
    elif feature[2] == 'gene':
        if feature.attrs.get('gene', None) == featuretype:
            return True
    elif feature[2] in ['rRNA', 'tRNA', 'tmRNA', 'ncRNA']:
        if feature.attrs.get('product', None) == featuretype:
            return True
    return False
