docs: def get_value_from_schema(schema, definition: dict, key: str,
                            definition_key: str):
      """Gets a value from a schema and definition.
  
      If the value has references it will recursively attempt to resolve them.
  
      :param ResourceSchema schema: The resource schema.
      :param dict definition: The definition dict from the schema.
      :param str key: The key to use to get the value from the schema.
      :param str definition_key: The name of the definition.
      :returns: The value.
      :raises TypeSystemError: If the key can't be found in the schema/definition
          or we can't resolve the definition.
      """
      resolved_definition = definition.copy()
      if '$ref' in resolved_definition:
          try:
              # NOTE: The resolve method recursively resolves references, so
              # we don't need to worry about that in this function.
              resolved_definition = schema.resolve(definition['$ref'])
          except SchemaError as e:
              raise TypeSystemError(str(e))
      try:
          value = resolved_definition[key]
      except KeyError:
          # Before raising an error, the resolved definition may have an array
          # or object inside it that needs to be resolved in order to get
          # values.  Attempt that here and then fail if we still can't find
          # the key we are looking for.
  
          # If the key was missing and this is an array, try to resolve it
          # from the items key.
          if resolved_definition['type'] == 'array':
              return [
                  get_value_from_schema(schema, resolved_definition['items'], key,
                                        definition_key)
              ]
          # If the key was missing and this is an object, resolve it from it's
          # properties.
          elif resolved_definition['type'] == 'object':
              value = {}
              for prop, definition in resolved_definition['properties'].items():
                  value[prop] = get_value_from_schema(
                      schema, definition, key, definition_key)
              return value
          raise TypeSystemError(
              'Definition `{}` is missing a {}.'.format(
                  definition_key, key))
      return value