def decode_mailbox_name(name):
 def demodify(m):
  s = m.group()
  if (s == '+'):
   return '+-'
  return (('+' + s[1:(-1)].replace(',', '/')) + '-')
 ret = MUTF7_SHIFT_RE.sub(demodify, name)
 try:
  return ret.decode('utf-7').encode('utf-8')
 except (UnicodeDecodeError, UnicodeEncodeError):
  return name

def decode_mailbox_name ( name ) : def demodify ( m ) : s = m . group ( ) if ( s == '+' ) : return '+-' return ( ( '+' + s [ 1 : ( - 1 ) ] . replace ( ',' , '/' ) ) + '-' ) ret = MUTF7_SHIFT_RE . sub ( demodify , name ) try : return ret . decode ( 'utf-7' ) . encode ( 'utf-8' ) except ( UnicodeDecodeError , UnicodeEncodeError ) : return name
decodes a modified utf-7 mailbox name .