def _build_precondition_join_fn(cls, fn):
    """Build a check_precondition function that uses both the old precondition check as well as the new function fn

    cls: class whose check_precondition should be used as a base
    fn: check_precondition function to check
    Returns a function that can replace a handler check_precondition method
    """
    old_precondition = cls.check_precondition
    def check_precondition():
        result, message = fn()
        if not result:
            return result, message
        return old_precondition()
    return staticmethod(check_precondition)
Build a check_precondition function that uses both the old precondition check as well as the new function fn

    cls: class whose check_precondition should be used as a base
    fn: check_precondition function to check
    Returns a function that can replace a handler check_precondition method
    
nogotofail/mitm/connection/handlers/preconditions.py