old_contents: import json
  from relay_api.core.relay import relay
  from relay_api.conf.config import relays
  
  
  def init_relays():
      for r in relays:
          relays[r]["object"] = relay(relays[r]["gpio"])
          relays[r]["state"] = relays[r]["object"].get_state()
  
  
  def get_all_relays():
      relays_dict = __get_relay_dict()
      return json.dumps(relays_dict)
  
  
  def get_relay(relay_name):
      if relay_name not in relays:
          return None
      relay_dict = __get_relay_dict(relay_name)
      return json.dumps(relay_dict)
  
  
  def __get_relay_dict(relay_name=None):
      if relay_name:
          relay_dict = dict.copy(relays["relay_name"])
          del(relay_dict["object"])
          return relay_dict
      relays_dict = dict.copy(relays)
      for r in relays_dict:
          del(relays_dict[r]["object"])
      return relays_dict
  
new_contents: import json
  from relay_api.core.relay import relay
  from relay_api.conf.config import relays
  
  
  def init_relays():
      for r in relays:
          relays[r]["object"] = relay(relays[r]["gpio"])
          relays[r]["state"] = relays[r]["object"].get_state()
  
  
  def get_all_relays():
      relays_dict = __get_relay_dict()
      return json.dumps(relays_dict, indent=4)
  
  
  def get_relay(relay_name):
      if relay_name not in relays:
          return None
      relay_dict = __get_relay_dict(relay_name)
      return json.dumps(relay_dict, indent=4)
  
  
  def __get_relay_dict(relay_name=None):
      if relay_name:
          relay_dict = dict.copy(relays["relay_name"])
          del(relay_dict["object"])
          return relay_dict
      relays_dict = dict.copy(relays)
      for r in relays_dict:
          del(relays_dict[r]["object"])
      return relays_dict
  
subject: Add indent in json to improve debugging