docs: def _flatten_schema(schema):
      """
      :type schema: dict
      """
      def _flatten(schema, parent_path, result):
          """
          :type schema: dict
          """
          for path, value in schema.items():
              # for supporting schemas like Product.user: {...},
              # we transform, say, Product.user to 'user' string
              if isinstance(path, InstrumentedAttribute):
                  path = path.key
  
              if isinstance(value, tuple):
                  join_method, inner_schema = value[0], value[1]
              elif isinstance(value, dict):
                  join_method, inner_schema = JOINED, value
              else:
                  join_method, inner_schema = value, None
  
              full_path = parent_path + '.' + path if parent_path else path
              result[full_path] = join_method
  
              if inner_schema:
                  _flatten(inner_schema, full_path, result)
  
      result = {}
      _flatten(schema, '', result)
      return result