def get_problem_name(base_name, was_reversed=False, was_copy=False):
  """Construct a problem name from base and reversed/copy options.

  Inverse of `parse_problem_name`.

  Args:
    base_name: base problem name. Should not end in "_rev" or "_copy"
    was_reversed: if the problem is to be reversed
    was_copy: if the problem is to be copied

  Returns:
    string name consistent with use with `parse_problem_name`.

  Raises:
    ValueError if `base_name` ends with "_rev" or "_copy"
  """
  if any(base_name.endswith(suffix) for suffix in ("_rev", "_copy")):
    raise ValueError("`base_name` cannot end in '_rev' or '_copy'")
  name = base_name
  if was_copy:
    name = "%s_copy" % name
  if was_reversed:
    name = "%s_rev" % name
  return name