def _get_bakery_dynamic_attr(self, attname, obj, args=None, default=None):
try:<EOL><INDENT>attr = getattr(self, attname)<EOL><DEDENT>except AttributeError:<EOL><INDENT>return default<EOL><DEDENT>if callable(attr) or args:<EOL><INDENT>args = args[:] if args else []<EOL>try:<EOL><INDENT>code = six.get_function_code(attr)<EOL><DEDENT>except AttributeError:<EOL><INDENT>code = six.get_function_code(attr.__call__)<EOL><DEDENT>if code.co_argcount == <NUM_LIT:2> + len(args):  <EOL><INDENT>args.append(obj)<EOL><DEDENT>return attr(*args)<EOL><DEDENT>return attr<EOL>
Allows subclasses to provide an attribute (say, 'foo') in three
different ways: As a fixed class-level property or as a method
foo(self) or foo(self, obj). The second argument argument 'obj' is
the "subject" of the current Feed invocation. See the Django Feed
documentation for details.

This method was shamelessly stolen from the Feed class and extended
with the ability to pass additional arguments to subclass methods.