<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 def artist_to_ref(artist):
 """Convert a mopidy artist to a mopidy ref."""

    if artist.name:
        name = artist.name
    else:
        name = 'Unknown artist'
    return Ref.directory(uri=artist.uri, name=name)