code: def encode_content(self, robj, rpb_content):
          
          if robj.content_type:
              rpb_content.content_type = str_to_bytes(robj.content_type)
          if robj.charset:
              rpb_content.charset = str_to_bytes(robj.charset)
          if robj.content_encoding:
              rpb_content.content_encoding = str_to_bytes(robj.content_encoding)
          for uk in robj.usermeta:
              pair = rpb_content.usermeta.add()
              pair.key = str_to_bytes(uk)
              pair.value = str_to_bytes(robj.usermeta[uk])
          for link in robj.links:
              pb_link = rpb_content.links.add()
              try:
                  bucket, key, tag = link
              except ValueError:
                  raise RiakError("Invalid link tuple %s" % link)
  
              pb_link.bucket = str_to_bytes(bucket)
              pb_link.key = str_to_bytes(key)
              if tag:
                  pb_link.tag = str_to_bytes(tag)
              else:
                  pb_link.tag = str_to_bytes('')
  
          for field, value in robj.indexes:
              pair = rpb_content.indexes.add()
              pair.key = str_to_bytes(field)
              pair.value = str_to_bytes(str(value))
  
          # Python 2.x data is stored in a string
          if six.PY2:
              rpb_content.value = str(robj.encoded_data)
          else:
              rpb_content.value = robj.encoded_data
docs: Fills an RpbContent message with the appropriate data and
          metadata from a RiakObject.
  
          :param robj: a RiakObject
          :type robj: RiakObject
          :param rpb_content: the protobuf message to fill
          :type rpb_content: riak.pb.riak_pb2.RpbContent