def new_metric(self, meta):
type_ = meta.get('<STR_LIT:type>')<EOL>if not type_:<EOL><INDENT>raise ValueError('<STR_LIT>')<EOL><DEDENT>if type_ in available_metrics:<EOL><INDENT>metric_obj = available_metrics[type_](meta, self.routing_queue)  <EOL>metric_meta = pd.DataFrame({metric_obj.local_id: meta}).T  <EOL>self.metrics_meta = self.metrics_meta.append(metric_meta)  <EOL>self.metrics[metric_obj.local_id] = metric_obj  <EOL>this_metric_subscribers = self.__reversed_filter(self.subscribers, meta)<EOL>if this_metric_subscribers.empty:<EOL><INDENT>logger.debug('<STR_LIT>', metric_obj.local_id)<EOL><DEDENT>else:<EOL><INDENT>logger.debug('<STR_LIT>', this_metric_subscribers)<EOL>this_metric_subscribers['<STR_LIT:id>'] = metric_obj.local_id<EOL>found_callbacks = this_metric_subscribers[['<STR_LIT:id>', '<STR_LIT>']].set_index('<STR_LIT:id>')<EOL>self.callbacks = self.callbacks.append(found_callbacks)<EOL><DEDENT>return metric_obj<EOL><DEDENT>else:<EOL><INDENT>raise NotImplementedError('<STR_LIT>' % type_)<EOL><DEDENT>
Create and register metric,
find subscribers for this metric (using meta as filter) and subscribe

Return:
    metric (available_metrics[0]): one of Metric