def decoder(s, errors=None):
 r = []
 decode = []
 for c in s:
  if ((c == '&') and (not decode)):
   decode.append('&')
  elif ((c == '-') and decode):
   if (len(decode) == 1):
    r.append('&')
   else:
    r.append(modified_unbase64(''.join(decode[1:])))
   decode = []
  elif decode:
   decode.append(c)
  else:
   r.append(c)
 if decode:
  r.append(modified_unbase64(''.join(decode[1:])))
 return (''.join(r), len(s))

def decoder ( s , errors = None ) : r = [ ] decode = [ ] for c in s : if ( ( c == '&' ) and ( not decode ) ) : decode . append ( '&' ) elif ( ( c == '-' ) and decode ) : if ( len ( decode ) == 1 ) : r . append ( '&' ) else : r . append ( modified_unbase64 ( '' . join ( decode [ 1 : ] ) ) ) decode = [ ] elif decode : decode . append ( c ) else : r . append ( c ) if decode : r . append ( modified_unbase64 ( '' . join ( decode [ 1 : ] ) ) ) return ( '' . join ( r ) , len ( s ) )
decode the given c{str} using the imap4 specific variation of utf-7 .