def header_quopri_len(s):
 count = 0
 for c in s:
  if hqre.match(c):
   count += 3
  else:
   count += 1
 return count

def header_quopri_len ( s ) : count = 0 for c in s : if hqre . match ( c ) : count += 3 else : count += 1 return count
return the length of str when it is encoded with header quopri .