def has_as_dict_attribute(python_object):
    """Checks if an object has a callable "as_dict" attribute

    :param python_object: any Python object
    """
    if not hasattr(python_object.__class__, 'as_dict') and callable(getattr
        (python_object.__class__, 'as_dict')):
        raise AttributeError(
            'Passed in Python object does not have an as_dict method.')
