<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 def sort_by_name(names):
 """Sort by last name, uniquely."""


    def last_name_key(full_name):
        parts = full_name.split(' ')
        if len(parts) == 1:
            return full_name.upper()
        last_first = parts[-1] + ' ' + ' '.join(parts[:-1])
        return last_first.upper()

    return sorted(set(names), key=last_name_key)