'Get priority from message.
The value is limited to within a boundary of 0 to 9.
Note:
Higher value has more priority.'

def _get_message_priority(self, message, reverse=False):

    try:
        priority = max(min(int(message[u'properties'][u'priority']), self.max_priority), self.min_priority)
    except (TypeError, ValueError, KeyError):
        priority = self.default_priority
    return ((self.max_priority - priority) if reverse else priority)
