function isPaymentFactory(payment) {
  return script => {
    try {
      payment({ output: script });
      return true;
    } catch (err) {
      return false;
    }
  };
}
Checks if a given payment factory can generate a payment script from a given script.
@param payment The payment factory to check.
@returns A function that takes a script and returns a boolean indicating whether the payment factory can generate a payment script from the script.