#NEWLINE# def locattr( accessing_obj , accessed_obj , * args , **kwargs ) : #NEWLINE# #INDENT# '\n    Usage:\n      locattr(attrname)\n      locattr(attrname, value)\n      locattr(attrname, value, compare=type)\n\n    Works like attr, except it looks for an attribute on\n    accessing_obj.location, if such an entity exists.\n\n    if accessing_obj has a property ".obj" (such as is the case for a\n    Command), then accessing_obj.obj.location is used instead.\n\n    ' #NEWLINE# if hasattr ( accessing_obj , 'obj' ) : #NEWLINE# #INDENT# accessing_obj = accessing_obj . obj #NEWLINE# #UNINDENT# if hasattr ( accessing_obj , 'location' ) : #NEWLINE# #INDENT# return attr ( accessing_obj . location , accessing_obj , * args , ** kwargs )