def implementsConstraint(obj):
  """
  Check whether object implements a constraint.
  """
  result = True
  available = dir(obj)
  required = ["preinitialize",
              "verifyConfiguration",
              "initialize",
              "setConstraintSizes",
              "setConstraints",
              "setField",
              "poststep",
              "writeData",
              "finalize"]
  for attr in required:
    if not attr in available:
      result = False
  return result