@staticmethod
def _op_method(script):
    """Returns the last method of fit or predict.

        If fit is called, the last call is always returned, regardless
        of whether predict is called.
        """
    predict = None
    for call in reversed(script.calls):
        if call.name == 'fit':
            return call
        elif call.name == 'predict':
            predict = call
    return predict
