parameters: (data)
return_statement: return rle
docstring: Use run-length encoding to pack the bytes
docstring_summary: Use run-length encoding to pack the bytes
docstring_tokens: Use run - length encoding to pack the bytes
function: def pack_rle(data):
    """Use run-length encoding to pack the bytes"""
    rle = []
    value = data[0]
    count = 0
    for i in data:
      if i != value or count == 255:
        rle.append(count)
        rle.append(value)
        value = i
        count = 1
      else:
        count += 1
    rle.append(count)
    rle.append(value)
    return rle
function_tokens: def pack_rle ( data ) : rle = [ ] value = data [ 0 ] count = 0 for i in data : if i != value or count == 255 : rle . append ( count ) rle . append ( value ) value = i count = 1 else : count += 1 rle . append ( count ) rle . append ( value ) return rle