def messy_split(long_line):
 new_list = []
 old_list = long_line.split('=')
 for line in old_list:
  if (len(line) != 0):
   line += ('=' * ((4 - (len(line) % 4)) % 4))
   new_list.append(line)
 return new_list

def messy_split ( long_line ) : new_list = [ ] old_list = long_line . split ( '=' ) for line in old_list : if ( len ( line ) != 0 ) : line += ( '=' * ( ( 4 - ( len ( line ) % 4 ) ) % 4 ) ) new_list . append ( line ) return new_list
split on = gives me the right sections but deletes the b64 padding use modulo math to restore padding .