def METHOD_NAME(leaf_frame):
    """Heuristically unwind native stack frames to search for local variable ip if available"""
    frame = leaf_frame
    while frame is not None:
        ip = frame.FindVariable("ip")
        if ip is not None:
            return ip.GetValueAsUnsigned()
        frame = frame.get_parent_frame()
    return 0