def _swap_first_args(op):
  """
  Given a binary operator function, return a function that applies it
  but with argument order swapped for the first two arguments.
  """

  def op_swapped(a, b, *args, **kwargs):
    return op(b, a, *args, **kwargs)

  return op_swapped