def convert_sklearn_metric_function(scoring):
    """If ``scoring`` is a sklearn metric function, convert it to a
    sklearn scorer and return it. Otherwise, return ``scoring`` unchanged."""
    if callable(scoring):
        module = getattr(scoring, '__module__', None)
        if (
                hasattr(module, 'startswith') and
                module.startswith('sklearn.metrics.') and
                not module.startswith('sklearn.metrics.scorer') and
                not module.startswith('sklearn.metrics.tests.')
        ):
            return make_scorer(scoring)
    return scoring
def convert_sklearn_metric_function ( scoring ) : if callable ( scoring ) : module = getattr ( scoring , '__module__' , None ) if ( hasattr ( module , 'startswith' ) and module . startswith ( 'sklearn.metrics.' ) and not module . startswith ( 'sklearn.metrics.scorer' ) and not module . startswith ( 'sklearn.metrics.tests.' ) ) : return make_scorer ( scoring ) return scoring
If ``scoring`` is a sklearn metric function, convert it to a
    sklearn scorer and return it. Otherwise, return ``scoring`` unchanged.