def _filterClassBases(classes, match):
    """Filters a list of AST classes.

    Classes whose ast.ClassDef.id or astClassDef.attr attributes do not
    match the 'match' string input are removed.

    Parameters
    ----------
    classes  : list of ast.ClassDef objects
    match    : str
        The string to match to ast.ClassDef.id or ast.ClassDef.base

    Returns
    -------
    rClasses : list of ast.ClassDef objects
        The filtered list of classes whose id or attr base attributes match
        the string in the `match` variable.

    """
    rClasses = []
    for cls in classes:
        # First check the id field
        try:
            if match in (base.id for base in cls.bases):
                rClasses.append(cls)
        except AttributeError:
            pass

        # Now check for attributes
        try:
            if match in (base.attr for base in cls.bases):
                rClasses.append(cls)
        except AttributeError:
            continue

    return rClasses