def extend_data(data, length, offset):
 if (length >= offset):
  new_data = (data[(- offset):] * (alignValue(length, offset) // offset))
  return (data + new_data[:length])
 else:
  return (data + data[(- offset):((- offset) + length)])

def extend_data ( data , length , offset ) : if ( length >= offset ) : new_data = ( data [ ( - offset ) : ] * ( alignValue ( length , offset ) // offset ) ) return ( data + new_data [ : length ] ) else : return ( data + data [ ( - offset ) : ( ( - offset ) + length ) ] )
extend data using a length and an offset .