code: def parse_meta(meta_str):
          
          keys_vals = [(x, y) for x, _, y in regex_meta.findall(meta_str.strip())]
          extra_text = regex_meta.split(meta_str.strip())[-1]
          result = OrderedDict()
          for key, val in keys_vals:
              # regex can include trailing whitespace or inverted commas
              # remove it
              val = val.strip().strip("'").strip('"')
              if key == 'text':
                  val = val.lstrip("{").rstrip("}")
              if key in result:
                  if key == 'tag':
                      result[key].append(val)
                  else:
                      raise ValueError("Duplicate key {0} found".format(key))
              else:
                  if key == 'tag':
                      result[key] = [val]
                  else:
                      result[key] = val
          if extra_text:
              result['comment'] = extra_text
  
          return result
docs: Parse the metadata for a single ds9 region string.
  
          Parameters
          ----------
          meta_str : `str`
              Meta string, the metadata is everything after the close-paren of the
              region coordinate specification. All metadata is specified as
              key=value pairs separated by whitespace, but sometimes the values
              can also be whitespace separated.
  
          Returns
          -------
          meta : `~collections.OrderedDict`
              Dictionary containing the meta data