pack() row and column into the required 3 byte format.
517055
def cell_to_packed_rowcol(cell)
    row, col, row_rel, col_rel = cell_to_rowcol(cell)

    exit "Column #{cell} greater than IV in formula\n" if col >= 256
    exit "Row #{cell} greater than 65536 in formula\n" if row >= 65536

    # Set the high bits to indicate if row or col are relative.
    col    |= col_rel << 14
    col    |= row_rel << 15

    row     = [row].pack('v')
    col     = [col].pack('v')

    [row, col]
  end
282259
private byte[] columnNameAsByteArray(String column, String columnFamily)
    {
        return TBaseHelper.byteBufferToByteArray(columnNameAsBytes(column, columnFamily));
    }
420776
def _tabulate(rows, headers, spacing=5):
    """"""
    if len(rows) == 0:
        return "None\n"
    assert len(rows[0]) == len(headers)
    count = len(rows[0])
    widths = [0 for _ in range(count)]
    rows = [headers] + rows

    for row in rows:
        for index, field in enumerate(row):
            if len(str(field)) > widths[index]:
                widths[index] = len(str(field))

    output = ""
    for row in rows:
        for index, field in enumerate(row):
            field = str(field)
            output += field + (widths[index] - len(field) + spacing) * " "
        output += "\n"
    return output
883684
def pack_data(abi_types, values) -> bytes:
    """"""
    if len(abi_types) != len(values):
        raise ValueError(
            "Length mismatch between provided abi types and values.  Got "
            "{0} types and {1} values.".format(len(abi_types), len(values)),
        )

    normalized_values = map_abi_data([abi_address_to_hex], abi_types, values)

    return decode_hex(''.join(
        remove_0x_prefix(hex_encode_abi_type(abi_type, value))
        for abi_type, value
        in zip(abi_types, normalized_values)
    ))
51201
def _pack(self):
        """"""
        data = ByteBuffer()
        if not hasattr(self, '__fields__'):
            return data.array

        for field in self.__fields__:
            field.encode(self, data)
        return data.array
22463
def _row_to_str(self, row):
        # type: (List[str]) -> str
        
        _row_text = ''
        for col, width in self.col_widths.items():
            _row_text += self.COLUMN_SEP
            l_pad, r_pad = self._split_int(width - len(row[col]))
            _row_text += '{0}{1}{2}'.format(' ' * (l_pad + self.PADDING),
                                            row[col],
                                            ' ' * (r_pad + self.PADDING))

        _row_text += self.COLUMN_SEP + '\n'

        return _row_text
461307
def putcolslice(self, value, blc, trc, inc=[], startrow=0, nrow=-1, rowincr=1):
        """"""
        return self._table.putcolslice(self._column, value, blc, trc, inc, startrow, nrow, rowincr)
1021728
def prepare_rows(self,
                     rows,
                     indent,
                     has_header):

        ''''''

        out = []

        def row_wrapper(row):
            new_rows = [
                self.wrapfunc(item).split('\n')
                for item in row
            ]
            rows = []
            for item in map(lambda *args: args, *new_rows):
                if isinstance(item, (tuple, list)):
                    rows.append([substr or '' for substr in item])
                else:
                    rows.append([item])
            return rows

        logical_rows = [
            row_wrapper(row)
            for row in rows
        ]

        columns = map(lambda *args: args, *reduce(operator.add, logical_rows))

        max_widths = [
            max([len(six.text_type(item)) for item in column])
            for column in columns
        ]
        row_separator = self.row_delimiter * (len(self.prefix) + len(self.suffix) + sum(max_widths) +
                                              len(self.delim) * (len(max_widths) - 1))

        justify = self._JUSTIFY_MAP[self.justify.lower()]

        if self.separate_rows:
            out.append(
                self.ustring(
                    indent,
                    self.LIGHT_GRAY,  # pylint: disable=no-member
                    row_separator
                )
            )
        for physical_rows in logical_rows:
            for row in physical_rows:
                line = self.prefix \
                        + self.delim.join([
                                justify(six.text_type(item), width)
                                for (item, width) in zip(row, max_widths)
                        ]) + self.suffix
                out.append(
                    self.ustring(
                        indent,
                        self.WHITE,  # pylint: disable=no-member
                        line
                    )
                )
            if self.separate_rows or has_header:
                out.append(
                    self.ustring(
                        indent,
                        self.LIGHT_GRAY,  # pylint: disable=no-member
                        row_separator
                    )
                )
                has_header = False
        return out
503505
def iterboxed(self, rows):
        
        def asvalues(raw):
            """
            Convert a row of raw bytes into a flat row.

            Result may or may not share with argument
            """
            if self.bitdepth == 8:
                return raw
            if self.bitdepth == 16:
                raw = bytearray_to_bytes(raw)
                return array('H', struct.unpack('!%dH' % (len(raw) // 2), raw))
            assert self.bitdepth < 8
            width = self.width
            # Samples per byte
            spb = 8 // self.bitdepth
            out = newBarray()
            mask = 2 ** self.bitdepth - 1
            #                                      reversed range(spb)
            shifts = [self.bitdepth * it for it in range(spb - 1, -1, -1)]
            for o in raw:
                out.extend([mask & (o >> i) for i in shifts])
            return out[:width]

        return map(asvalues, rows)
382674
def rows_to_png(out, rows, size):
    

    # Write out PNG signature.
    out.write(bytearray([137, 80, 78, 71, 13, 10, 26, 10]))
    # Write out PNG header chunk.
    header = struct.pack(">2LBBBBB", size[0], size[1], 8, 0, 0, 0, 0)
    write_chunk(out, b"IHDR", header)

    bs = bytearray()
    for row in rows:
        bs.append(0)
        bs.extend(row)
    write_chunk(out, b"IDAT", zlib.compress(bs))

    write_chunk(out, b"IEND", bytearray())
676155
def pack_chunk(tag, data):
        """"""
        to_check = tag + data
        return (struct.pack(b"!I", len(data)) + to_check +
                struct.pack(b"!I", zlib.crc32(to_check) & 0xFFFFFFFF))
1268569
def _wrap_row(cls, row):
        """"""
        doc = row.get('doc')
        if doc is not None:
            return cls.wrap(doc)
        data = row['value']
        data['_id'] = row['id']
        return cls.wrap(data)
1053213
def pack(self, remaining_size):
        """"""
        arguments_count, payload = self.pack_data(remaining_size - self.header_size)
        payload_length = len(payload)

        # align payload length to multiple of 8
        if payload_length % 8 != 0:
            payload += b"\x00" * (8 - payload_length % 8)

        self.header = PartHeader(self.kind, self.attribute, arguments_count, self.bigargumentcount,
                                 payload_length, remaining_size)
        hdr = self.header_struct.pack(*self.header)
        if pyhdb.tracing:
            self.trace_header = humanhexlify(hdr, 30)
            self.trace_payload = humanhexlify(payload, 30)
        return hdr + payload
135232
def as_text(self, max_rows=0, sep=" | "):
        """"""
        if not max_rows or max_rows > self.num_rows:
            max_rows = self.num_rows
        omitted = max(0, self.num_rows - max_rows)
        labels = self._columns.keys()
        fmts = self._get_column_formatters(max_rows, False)
        rows = [[fmt(label, label=True) for fmt, label in zip(fmts, labels)]]
        for row in itertools.islice(self.rows, max_rows):
            rows.append([f(v, label=False) for v, f in zip(row, fmts)])
        lines = [sep.join(row) for row in rows]
        if omitted:
            lines.append('... ({} rows omitted)'.format(omitted))
        return '\n'.join([line.rstrip() for line in lines])
985230
def pack(self):
        """"""
        sn, sa = self.number, self.attribute
        return pack("<H", (sn & 0x3ff) << 6 | (sa & 0x3f))
1372093
def pack(window, sizer, expand=1.1):
    ""
    tsize =  window.GetSize()
    msize =  window.GetMinSize()
    window.SetSizer(sizer)
    sizer.Fit(window)
    nsize = (10*int(expand*(max(msize[0], tsize[0])/10)),
             10*int(expand*(max(msize[1], tsize[1])/10.)))
    window.SetSize(nsize)
706516
def pack(mtype, request, rid=None):
    ''''''
    envelope = wire.Envelope() 
    if rid is not None:
        envelope.id = rid
    envelope.type = mtype
    envelope.message = request.SerializeToString()
    data = envelope.SerializeToString()
    data = encoder._VarintBytes(len(data)) + data
    return data