def _has_child_process(func):
    """ Decorator that first checks to make sure that we have a child process
    before running func.
    Args:
      func: The function to decorate. """
    def wrapper(*args):
      # Expect the first argument to be the instance.
      self = args[0]
      if not self._child_process:
        raise RuntimeError("Cannot call this with attached process.")

      func(*args)

    return wrapper