def mask_sequence(seq, maskchar, fpos, tpos):
 if (len(maskchar) > 1):
  raise RuntimeError('Internal error: more than one character given to mask_sequence')
 if (fpos < 0):
  fpos = 0
 if (tpos > len(seq)):
  tpos = len(seq)
 newseq = ''.join((seq[:fpos], (maskchar * (tpos - fpos)), seq[tpos:]))
 return newseq

def mask_sequence ( seq , maskchar , fpos , tpos ) : if ( len ( maskchar ) > 1 ) : raise RuntimeError ( 'Internal error: more than one character given to mask_sequence' ) if ( fpos < 0 ) : fpos = 0 if ( tpos > len ( seq ) ) : tpos = len ( seq ) newseq = '' . join ( ( seq [ : fpos ] , ( maskchar * ( tpos - fpos ) ) , seq [ tpos : ] ) ) return newseq
given a sequence .