'Get the ID of the current user.'

def get_user_id(self):

    user_service = self.runtime.service(self, 'user')
    if user_service:
        user_id = user_service.get_current_user().opt_attrs.get('edx-platform.user_id', None)
    else:
        user_id = None
    return user_id
