human
Complete this python program:
def can_create_collection(handler):
assistant
#Here is the Python code you requested.

    """Decorator to check whether the user can create a collection.
    """
    def test_can_create(self, **kwargs):
        if (self.user_id is None):
            raise self.NotLoggedInException
        if (role_services.ACTION_CREATE_COLLECTION in self.actions):
            return handler(self, **kwargs)
        else:
            raise base.UserFacingExceptions.UnauthorizedUserException('You    do    not    have    credentials    to    create    a    collection.')
    test_can_create.__wrapped__ = True
    return test_can_create