def require_opt(command, value, options, test_func=lambda x: x is not None):
  '''
  Verify options value is set correctly. Assumes options is an optparse.Values object.
  '''
  if not test_func(getattr(options, value)):
    fail("command '%s' requires a value for '%s'" % (command, value))
dataset/ETHPy150Open bloomreach/zinc/zinc.py/require_opt/original