code: def write_table(self, d):
          
          # HACK: encoding of AMQP tables is broken because it requires the
          # length of the /encoded/ data instead of the number of items. To
          # support streaming, fiddle with cursor position, rewinding to write
          # the real length of the data. Generally speaking, I'm not a fan of
          # the AMQP encoding scheme, it could be much faster.
          table_len_pos = len(self._output_buffer)
          self.write_long(0)
          table_data_pos = len(self._output_buffer)
  
          for key, value in d.iteritems():
              self._write_item(key, value)
  
          table_end_pos = len(self._output_buffer)
          table_len = table_end_pos - table_data_pos
  
          self.write_long_at(table_len, table_len_pos)
          return self
docs: Write out a Python dictionary made of up string keys, and values
          that are strings, signed integers, Decimal, datetime.datetime, or
          sub-dictionaries following the same constraints.