docs: def serialize_rdf(update_graph, signing):
      '''Tweak rdflib's pretty-xml serialization of update_graph into
      the "indentical" representation as defined in http://mzl.la/x4XF6o
      '''
      unsorted_s = update_graph.serialize(format = 'pretty-xml')
      unsorted_s = unsorted_s.replace('xmlns:rdf', 'xmlns:RDF')
      unsorted_s = unsorted_s.replace('rdf:', 'RDF:')
      unsorted_s = unsorted_s.replace('RDF:about', 'about')
      unsorted_s = unsorted_s.split('\n')
      start, end = unsorted_s[0:5], unsorted_s[-2:]
      unsorted_s = unsorted_s[5:-2]
      if signing:
          unsorted_s = [line[2:] for line in unsorted_s]
          unsorted_s.append('')
      sorting_s = []
      prev_leading_spaces = -2
      for line in unsorted_s:
          leading_spaces = len(line) - len(line.lstrip())
          if leading_spaces > prev_leading_spaces:
              sorting_s.append([line])
          elif leading_spaces == prev_leading_spaces:
              sorting_s[-1].append(line)
          elif leading_spaces < prev_leading_spaces:
              tmp_line = sorting_s.pop()
              tmp_line = '\n'.join(sorted(tmp_line))
              tmp_line = [sorting_s[-1].pop(), tmp_line, line]
              tmp_line = '\n'.join(tmp_line)
              sorting_s[-1].append(tmp_line)
          prev_leading_spaces = leading_spaces
      if signing:
          sorted_s = '\n'.join(sorting_s[0])
      else:
          sorted_s = []
          sorted_s.extend(start)
          sorted_s.extend(sorting_s[0])
          sorted_s.extend(end)
          sorted_s = '\n'.join(sorted_s)
      return sorted_s