def calculate_radial_reduction(dmu_code, category, data, efficiency_score,
    orientation):
    """ Calculates radial reduction for a given DMU and category.

        Args:
            dmu_code (str): DMU code.
            category (str): category name.
            data (InputData): object that stores input data.
            efficiency_score (double): efficiency spyDEA.core.
            orientation (str): problem orientation, can take values
                input or output.

        Returns:
            double: radial reduction value.
    """
    if orientation == 'input':
        if category in data.output_categories:
            return 0
        objective_value = efficiency_score
    elif orientation == 'output':
        if category in data.input_categories:
            return 0
        objective_value = 1 / efficiency_score
    return (objective_value - 1) * data.coefficients[dmu_code, category]
