def get_attr(node, attrname, default=None):
    """Get content of a node's attr. If attr is not present, return default."""
    if attrname in node.attrs:
        return node.attrs[attrname].content
    return default