code: def _expands_schema(
      self, props: Dict[str, Any], definitions: List[Dict[str, Any]]
  ) -> Dict[str, Any]:
      new_schema = {}
      for name, definition in props.items():
          if "$ref" in definition:
              ref = definition["$ref"]
              ref_def = definitions[ref.replace("#/definitions/", "")]
              field_props = ref_def.get("properties", ref_def)
              expanded_props = self._expands_schema(
                  field_props, definitions
              )
              new_schema[name] = expanded_props.get(
                  "properties", expanded_props
              )
          elif "items" in definition and "$ref" in definition["items"]:
              ref = definition["items"]["$ref"]
              ref_def = definitions[ref.replace("#/definitions/", "")]
              field_props = ref_def.get("properties", ref_def)
              expanded_props = self._expands_schema(
                  field_props, definitions
              )
              definition["items"] = expanded_props.get(
                  "properties", expanded_props
              )
              new_schema[name] = definition
          elif (
              "additionalProperties" in definition
              and "$ref" in definition.get("additionalProperties", {})
          ):
              additionalProperties_refs = self._expands_schema(
                  {name: definition["additionalProperties"]},
                  definitions=definitions,
              )
              new_schema.update(additionalProperties_refs)
          elif "allOf" in definition:
              allOf_expanded = [
                  self._expands_schema(
                      definitions[
                          def_["$ref"].replace("#/definitions/", "")
                      ].get("properties", {}),
                      definitions,
                  )
                  for def_ in definition["allOf"]
                  if "$ref" in def_
              ]
              if len(allOf_expanded) == 1:
                  new_schema[name] = allOf_expanded[0]
              else:
                  new_schema[name] = allOf_expanded
          else:
              new_schema[name] = definition
      return new_schema
  
file_path: argilla/tests/unit/client/sdk/models/conftest.py
imports: import logging
  from typing import Any, Dict, List
  import pytest
label_desc: Use image node_id 5 for calling the Helpers obj's underlying member method code with example usage: obj._expands_schema(props, definitions) and returns: new_schema