def patch_object(*args, **kwargs):
  """Unified patch_object for various versions of Python Mock.

  Different Python Mock versions provide incompatible versions of patching an
  object. More recent versions use _patch_object, older ones used patch_object.
  This function unifies the different variations.

  """
  import mock
  try:
    # pylint: disable=W0212
    return mock._patch_object(*args, **kwargs)
  except __HOLE__:
    # pylint: disable=E1101
    return mock.patch_object(*args, **kwargs)
dataset/ETHPy150Open ganeti/ganeti/test/py/testutils/__init__.py/patch_object