code: def prepare_service(data):
      if not data:
          return None, {}
      if isinstance(data, str):
          return data, {}
      if all(field in data for field in ("Node", "Service", "Checks")):
          return data["Service"]["ID"], data["Service"]
      if all(field in data for field in ("ServiceName", "ServiceID")):
          return data["ServiceID"], {
              "ID": data["ServiceID"],
              "Service": data["ServiceName"],
              "Tags": data.get("ServiceTags"),
              "Address": data.get("ServiceAddress"),
              "Port": data.get("ServicePort"),
          }
      if list(data) == ["ID"]:
          return data["ID"], {}
      result = {}
      if "Name" in data:
          result["Service"] = data["Name"]
      for k in ("Service", "ID", "Tags", "Address", "Port"):
          if k in data:
              result[k] = data[k]
      return result.get("ID"), result