def _convert_valid_actions(valid_actions):
  """Convert provided valid_actions for gRPC.

  Args:
    valid_actions: Either None, a list of bools or a numpy boolean array.
  Returns:
    None if valid_actions is None. Otherwise, a list of bools.
  """
  if valid_actions is None:
    return None
  return list(map(bool, valid_actions))