<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 def authorize(context, action, target, do_raise=True):
 """Verify that the action is valid on the target in this context. :param context: monasca project context :param action: String representing the action to be checked. This should be colon separated for clarity. :param target: Dictionary representing the object of the action for object creation. This should be a dictionary representing the location of the object e.g. ``{'project_id': 'context.project_id'}`` :param do_raise: if True (the default), raises PolicyNotAuthorized, if False returns False :type context: object :type action: str :type target: dict :type do_raise: bool :return: returns a non-False value (not necessarily True) if authorized, and the False if not authorized and do_raise if False :raises oslo_policy.policy.PolicyNotAuthorized: if verification fails """

    init()
    credentials = context.to_policy_values()
    try:
        result = _ENFORCER.authorize(action, target, credentials,
                                     do_raise=do_raise, action=action)
        return result
    except policy.PolicyNotRegistered:
        LOG.exception('Policy not registered')
        raise
    except Exception:
        LOG.debug('Policy check for %(action)s failed with credentials '
                  '%(credentials)s',
                  {'action': action, 'credentials': credentials})
        raise