def pack_field(self, value):
        """
        Pack single field (string or integer value)
        <field> ::= <int32_varint><data>

        :param value: value to be packed
        :type value: bytes, str, int or long

        :return: packed value
        :rtype: bytes
        """
        if isinstance(value, str):
            return self.pack_str(value)
        elif isinstance(value, unicode):
            return self.pack_unicode(value, self.charset, self.errors)
        elif isinstance(value, int):
            return self.pack_int(value)
        elif isinstance(value, long):
            return self.pack_long(value)
        else:
            raise TypeError("Invalid argument type '%s'. Only 'str', 'int' or long expected" % (type(value).__name__))