def METHOD_NAME(self, oprot):
    if oprot._fast_encode is not None and self.thrift_spec is not None:
        oprot.trans.METHOD_NAME(oprot._fast_encode(self, [self.__class__, self.thrift_spec]))
        return
    oprot.writeStructBegin('TCompletionHint')
    if self.type is not None:
        oprot.writeFieldBegin('type', TType.I32, 1)
        oprot.writeI32(self.type)
        oprot.writeFieldEnd()
    if self.hints is not None:
        oprot.writeFieldBegin('hints', TType.LIST, 2)
        oprot.writeListBegin(TType.STRING, len(self.hints))
        for iter6 in self.hints:
            oprot.writeString(iter6.encode('utf-8') if sys.version_info[0] == 2 else iter6)
        oprot.writeListEnd()
        oprot.writeFieldEnd()
    if self.replaced is not None:
        oprot.writeFieldBegin('replaced', TType.STRING, 3)
        oprot.writeString(self.replaced.encode('utf-8') if sys.version_info[0] == 2 else self.replaced)
        oprot.writeFieldEnd()
    oprot.writeFieldStop()
    oprot.writeStructEnd()