code: def xadd(self, name, fields, id='*', maxlen=None, approximate=True):
          
          pieces = []
          if maxlen is not None:
              if not isinstance(maxlen, (int, long)) or maxlen < 1:
                  raise DataError('XADD maxlen must be a positive integer')
              pieces.append(Token.get_token('MAXLEN'))
              if approximate:
                  pieces.append(Token.get_token('~'))
              pieces.append(str(maxlen))
          pieces.append(id)
          if not isinstance(fields, dict) or len(fields) == 0:
              raise DataError('XADD fields must be a non-empty dict')
          for pair in iteritems(fields):
              pieces.extend(pair)
          return self.execute_command('XADD', name, *pieces)
docs: Add to a stream.
          name: name of the stream
          fields: dict of field/value pairs to insert into the stream
          id: Location to insert this record. By default it is appended.
          maxlen: truncate old stream members beyond this size
          approximate: actual stream length may be slightly more than maxlen