human
I wrote the below code

    if (not args):
        return False
    attrname = args[0].strip()
    value = None
    if (len(args) > 1):
        value = args[1].strip()
    compare = 'eq'
    if kwargs:
        compare = kwargs.get('compare', 'eq')
    def valcompare(val1, val2, typ='eq'):
        'compare    based    on    type'
        try:
            return CF_MAPPING.get(typ, CF_MAPPING['default'])(val1, val2)
        except Exception:
            return False
    if hasattr(accessing_obj, 'obj'):
        accessing_obj = accessing_obj.obj
    if hasattr(accessing_obj, attrname):
        if value:
            return valcompare(str(getattr(accessing_obj, attrname)), value, compare)
        return bool(getattr(accessing_obj, attrname))
    if (hasattr(accessing_obj, 'attributes') and accessing_obj.attributes.has(attrname)):
        if value:
            return (hasattr(accessing_obj, 'attributes') and valcompare(accessing_obj.attributes.get(attrname), value, compare))
        return bool(accessing_obj.attributes.get(attrname))
    return False

What's a good function header?
 What is a Python program to compare = 'eq'?
assistant
#Here is Python program to compare = 'eq'
.

def attr(accessing_obj, accessed_obj, *args, **kwargs):