def custom_decode(encoding):
 encoding = encoding.lower()
 alternates = {'big5': 'big5hkscs', 'gb2312': 'gb18030', 'ascii': 'utf-8', 'MacCyrillic': 'cp1251'}
 if (encoding in alternates):
  return alternates[encoding]
 else:
  return encoding

def custom_decode ( encoding ) : encoding = encoding . lower ( ) alternates = { 'big5' : 'big5hkscs' , 'gb2312' : 'gb18030' , 'ascii' : 'utf-8' , 'MacCyrillic' : 'cp1251' } if ( encoding in alternates ) : return alternates [ encoding ] else : return encoding
overrides encoding when charset declaration or charset determination is a subset of a larger charset .