def get_metric_order(metric_key: str) -> int:
    """
    Returns 'order' of a metric (how to compare it)
    :param metric_key: key of the metric
    :return: -1 if 'smaller is better' (e.g. loss) and +1 if 'greater is better' (e.g. accuracy)
    """
    key = metric_key.strip().lower()
    if key.endswith('loss'):
        return -1
    if key.endswith('acc') or key.endswith('accuracy') or key.endswith('auc'):
        return 1
    raise ValueError("Could not define ordering of a metric: {}, please provide it manually".format(metric_key))