class Bitfilter(object):
    def __init__(
            self, frames_to_include=None, frames_to_exclude=[],
            bits_to_exclude=[]):
        self.frames_to_include = frames_to_include
        self.frames_to_exclude = frames_to_exclude
        self.bits_to_exclude = bits_to_exclude

    def filter(self, frame, bit):
        if self.frames_to_include is not None:
            if frame in self.frames_to_include:
                return True

        if frame in self.frames_to_exclude:
            return False

        if (frame, bit) in self.bits_to_exclude:
            return False

        return True


BITFILTERS = {
    ('artix7', 'INT'):
    Bitfilter(
        frames_to_exclude=[
            30, 31,
        ],
        bits_to_exclude=[
            #
            (0, 36)
        ]),
}


def get_bitfilter(part, tile):
    """ Returns bitfilter for specified part and tile.

    Either returns bitfilter to specified part and tile type, or the default
    bitfilter, which includes all bits.
    """
    key = (part, tile)
    if key in BITFILTERS:
        return BITFILTERS[key].filter
    else:
        return None

class Bitfilter(object):
    def __init__(
            self, frames_to_include=None, frames_to_exclude=[],
            bits_to_exclude=[]):
        self.frames_to_include = frames_to_include
        self.frames_to_exclude = frames_to_exclude
        self.bits_to_exclude = bits_to_exclude

    def filter(self, frame, bit):
        if self.frames_to_include is not None:
            if frame in self.frames_to_include:
                return True

        if frame in self.frames_to_exclude:
            return False

        if (frame, bit) in self.bits_to_exclude:
            return False

        return True


BITFILTERS = {
    ('artix7', 'INT'):
    Bitfilter(
        frames_to_exclude=[
            30,
            31,
        ],
        bits_to_exclude=[
            #
            (0, 36)
        ]),
}


def get_bitfilter(part, tile):
    """ Returns bitfilter for specified part and tile.

    Either returns bitfilter to specified part and tile type, or the default
    bitfilter, which includes all bits.
    """
    key = (part, tile)
    if key in BITFILTERS:
        return BITFILTERS[key].filter
    else:
        return None

make format.