def _get_name_info(name_index, name_list):
argval = name_index<EOL>if name_list is not None:<EOL><INDENT>try:<EOL><INDENT>argval = name_list[name_index]<EOL><DEDENT>except IndexError:<EOL><INDENT>raise ValidationError("<STR_LIT>".format(name_index)) from None<EOL><DEDENT>argrepr = argval<EOL><DEDENT>else:<EOL><INDENT>argrepr = repr(argval)<EOL><DEDENT>return argval, argrepr<EOL>
Helper to get optional details about named references

       Returns the dereferenced name as both value and repr if the name
       list is defined.
       Otherwise returns the name index and its repr().