Construct a string representation of a type annotation.

    Parameters
    ----------
    typ : type
        Type to turn into a string
    default : any
        Default value (if any) of the type

    Returns
    -------
    str
        String version of the type annotation

def string_annotation(typ, default):
    """
    Construct a string representation of a type annotation.

    Parameters
    ----------
    typ : type
        Type to turn into a string
    default : any
        Default value (if any) of the type

    Returns
    -------
    str
        String version of the type annotation
    """
    try:
        type_string = (
            f"`{typ.__name__}`"
            if typ.__module__ == "builtins"
            else f"`{typ.__module__}.{typ.__name__}`"
        )
    except AttributeError:
        type_string = f"`{str(typ)}`"
    if default is None:
        type_string = f"{type_string}, default ``None``"
    elif default == inspect._empty:
        pass
    else:
        type_string = f"{type_string}, default ``{default}``"
    return type_string