from typing import Optional


def link(url: Optional[str], label: str, cssclass: str = "btn btn-primary", target: str = "_blank") -> str:
    """Get an HTML link."""
    attrs = ""
    if cssclass:
        attrs += f' class="{cssclass}"'
    if target:
        attrs += f' target="{target}"'
    if url is not None:
        return f'<a href="{url}"{attrs}>{label}</a>'
    else:
        return ""