<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 def unique_name(device: InputDevice) -> str: """ Construct a unique name for the device based on, in order if available, the uniq ID, the phys ID and finally a concatenation of vendor, product, version and filename. :param device: An InputDevice instance to query :return: A string containing as unique as possible a name for the physical entity represented by the device """

    if device.uniq:
        return device.uniq
    elif device.phys:
        return device.phys.split('/')[0]
    return '{}-{}-{}-{}'.format(device.info.vendor, device.info.product, device.info.version, device.path)