def tryattrs(obj, *attrs):
    """Return the first value of the named attributes found of the given object."""
    for attr in attrs:
        try:
            return getattr(obj, attr)
        except AttributeError:
            pass
    obj_name = obj.__name__
    raise AttributeError("'{}' object has no attribute in {}", obj_name, attrs)