<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 def by_name(name):
 """Return a device by name. Args: name (str):
 The name of the device to return. Returns: :class:`~.SoCo`: The first device encountered among all zone with the given player name. If none are found `None` is returned. """

    devices = discover(all_households=True)
    for device in (devices or []):
        if device.player_name == name:
            return device
    return None