def _get_attr(obj, key, default=''):
    """Get an object attribute or an dict key"""
    ret = getattr(obj, key, None)
    if not ret and hasattr(obj, 'get'):
        ret = obj.get(key, None)
    if not ret:
        ret = default
    return ret
