import copy


def get_recurs_class(g, derivLink):
    """Find the recurs_class property in the contents.
    Return its value and the dictionary with recurs_value removed."""
    recursClass = 0
    if derivLink['content'] is None or len(derivLink['content']) <= 0:
        return 0, derivLink
    newDerivLink = copy.deepcopy(derivLink)
    for iObj in range(len(newDerivLink['content']))[::-1]:
        obj = newDerivLink['content'][iObj]
        if obj['name'] == 'recurs_class':
            try:
                recursClass = int(obj['value'])
            except ValueError:
                g.raise_error('Incorrect recurs_class value: ' +
                                            obj['value'])
            newDerivLink['content'].pop(iObj)
    return recursClass, newDerivLink