<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 def _batch_report(cls, request):
 """ Report the collected custom metrics to New Relic. """

        if not newrelic:
            return
        metrics_cache = cls._get_metrics_cache()
        try:
            newrelic.agent.add_custom_parameter('user_id', request.user.id)
        except AttributeError:
            pass
        for key, value in metrics_cache.data.items():
            newrelic.agent.add_custom_parameter(key, value)