In [ ]:
#Once you need to match an pattern, the best I can think of (without an example) is to suggest the use of regular expressions.

#Given the binary file `filepath`, you can use regex pattern matching with the following:

        import re
        
        with open('filepath', 'rb') as f:
            results = re.findall(b'whatever pattern', f.read())

#To speed up, you can compite the regex before using it:

        import re
        
        pattern = re.compile(b'whatever pattern')
        
        with open('filepath', 'rb') as f:
            results = pattern.findall(f.read())

#The 'cut' part if a whole other deal. 
#If using thit approach, I would suggest you to add the 4 bytes preceding your desired pattern in the regular expression itself:

        pattern = re.compile(b'[.]{4}whatever pattern')