docs: def get_layout_as_string(layout):
      """
          Take a dict or string and return a string.
          The dict will be json dumped.
          The string will json parsed to check for json validity. In order to deal
          with strings which have been json encoded multiple times, keep json decoding
          until a dict is retrieved or until a non-json structure is identified.
      """
  
      if isinstance(layout, dict):
          return json.dumps(layout)
  
      if(isinstance(layout, six.string_types)):
          try:
              return get_layout_as_string(json.loads(layout))
          except:
              return layout