predicate indicating whether a block of memory includes a magic number

def encoded_class(block, offset=0):
        """
        predicate indicating whether a block of memory includes a magic number
        """
        if not block:
            raise InvalidFileFormatNull

        for key in __magicmap__:
            if block.find(key, offset, offset + len(key)) > -1:
                return __magicmap__[key]

        raise InvalidFileFormat