<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 def general_eq(a, b, attributes):
 """Return whether two objects are equal up to the given attributes. If an attribute is called ``'phi'``, it is compared up to |PRECISION|. If an attribute is called ``'mechanism'`` or ``'purview'``, it is compared using set equality. All other attributes are compared with :func:`numpy_aware_eq`. """

    try:
        for attr in attributes:
            _a, _b = getattr(a, attr), getattr(b, attr)
            if attr in ['phi', 'alpha']:
                if not utils.eq(_a, _b):
                    return False
            elif attr in ['mechanism', 'purview']:
                if _a is None or _b is None:
                    if _a != _b:
                        return False
                elif not set(_a) == set(_b):
                    return False
            else:
                if not numpy_aware_eq(_a, _b):
                    return False
        return True
    except AttributeError:
        return False