Formats a visibility element into a string with both km and sm values

    Ex: 8km ( 5sm )

def visibility(vis: Number, unit: str = 'm') -> str:
    """
    Formats a visibility element into a string with both km and sm values

    Ex: 8km ( 5sm )
    """
    if not (vis and unit in ('m', 'sm')):
        return ''
    if vis.repr in VIS_REPR:
        return VIS_REPR[vis.repr]
    if unit == 'm':
        converted = vis.value * 0.000621371
        converted = str(round(converted, 1)).replace('.0', '') + 'sm'  # type: ignore
        value = str(round(vis.value / 1000, 1)).replace('.0', '')
        unit = 'km'
    elif unit == 'sm':
        converted = vis.value / 0.621371
        converted = str(round(converted, 1)).replace('.0', '') + 'km'  # type: ignore
        value = str(vis.value).replace('.0', '')
    return f'{value}{unit} ({converted})'