code: def register_backend(name, backend, allow_overwrite=False):
          
          if hasattr(Circuit, "run_with_" + name):
              if allow_overwrite:
                  warnings.warn(f"Circuit has attribute `run_with_{name}`.")
              else:
                  raise ValueError(f"Circuit has attribute `run_with_{name}`.")
          if not allow_overwrite:
              if name in BACKENDS:
                  raise ValueError(f"Backend '{name}' is already registered as backend.")
          BACKENDS[name] = backend
docs: Register new backend.
  
          Args:
              name (str): The name of backend.
              gateclass (type): The type object of backend
              allow_overwrite (bool, optional): If True, allow to overwrite the existing backend.
                  Otherwise, raise the ValueError.
  
          Raises:
              ValueError: The name is duplicated with existing backend.
                  When `allow_overwrite=True`, this error is not raised.