<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 def get_named_parent(decl):
 """ Returns a reference to a named parent declaration. Args: decl (declaration_t):
 the child declaration Returns: declaration_t: the declaration or None if not found. """


    if not decl:
        return None

    parent = decl.parent
    while parent and (not parent.name or parent.name == '::'):
        parent = parent.parent
    return parent