A part of my code didn’t work well, as below:

if mapping and mapping['colour'] is 'Red':
    print('Special colour')

It will not print out anything totally. So I directly printed out the actually value of mapping[‘colour’]:

# It showed 'Red' in console

Why ‘Red’ is not ‘Red’? After changed the judgement from ‘is’ to ‘==’, the result became correct.
The key is that UNICODE string and normal string is different in Python:

u'Red' is 'Red' # False
u'Red' == 'Red' # True

Seems we should use ‘==’ to compare two strings instead of ‘is’.