def Pad(ids, pad_id, length):
 assert (pad_id is not None)
 assert (length is not None)
 if (len(ids) < length):
  a = ([pad_id] * (length - len(ids)))
  return (ids + a)
 else:
  return ids[:length]

def Pad ( ids , pad_id , length ) : assert ( pad_id is not None ) assert ( length is not None ) if ( len ( ids ) < length ) : a = ( [ pad_id ] * ( length - len ( ids ) ) ) return ( ids + a ) else : return ids [ : length ]
pad or trim list to len length .