def METHOD_NAME(spec, suggestions=None):
    """If the user provided a bad format specification, returns a UsageError that tries to help them fix it."""
    if suggestions is None:
        suggestion = from_spec(spec, allow_unrecognised=True)
        suggestions = (
            [suggestion] if suggestion else all_supported_import_source_types()
        )
    try_the_following = (
        "Try one of the following" if len(suggestions) >= 2 else "Try the following"
    )
    return click.UsageError(
        f"Unrecognised import-source specification: {spec}\n"
        f"{try_the_following}:\n{suggest_specs(suggestions)}"
    )