def is_apple(filename):
    """
    check if the file is either a .app or a .ipa osX file
    """
    with open(filename, "rb") as f:
        # magic bytes in .app files
        if f.read(4) == b"\xcf\xfa\xed\xfe":
            return True
        f.seek(0)
        data = f.read(200)
        # .app and the word "Payload" is always in an ipa file
        if b".app" in data and b"Payload" in data:
            return True
    return False