'Get the Hub user for a given tornado handler.
Checks cookie with the Hub to identify the current user.
Args:
handler (tornado.web.RequestHandler): the current request handler
Returns:
user_model (dict): The user model, if a user is identified, None if authentication fails.
The \'name\' field contains the user\'s name.'

def get_user(self, handler):

    if hasattr(handler, '_cached_hub_user'):
        return handler._cached_hub_user
    handler._cached_hub_user = user_model = None
    token = self.get_token(handler)
    if token:
        user_model = self.user_for_token(token)
        if user_model:
            handler._token_authenticated = True
    if (user_model is None):
        user_model = self._get_user_cookie(handler)
    handler._cached_hub_user = user_model
    if (not user_model):
        app_log.debug('No    user    identified')
    return user_model
