<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 def _visit_or_none(node, attr, visitor, parent, visit="visit", **kws):
 """If the given node has an attribute, visits the attribute, and otherwise returns None. """

    value = getattr(node, attr, None)
    if value:
        return getattr(visitor, visit)(value, parent, **kws)

    return None