def max_category(data, max_categories):
    """Max Category Configuration

    WHAT: helper function for setting the max_categories
    parameter for wrangler()

    OPTIONS: integer value for max number of categories
             'max' for allowing any number of categories
             'auto' for allowing 1/50 of total values as
                    max number of categories

    INPUT: a dataframe or an array/series/list and the option

    OUTPUT: an integer representing the maximum allowed number
    of categories.


    """
    if max_categories == 'auto':
        max_categories = len(data) / 50
    elif max_categories == 'max':
        max_categories = len(data) + 1
    elif type(max_categories) == int:
        max_categories = max_categories
    elif max_categories is None:
        max_categories = len(data) + 1
    return max_categories
