def format_smashgg_url(url):
    """Converts bracket url to api url, if necessary."""
    if "api.smash.gg" not in url:
        url = "http://api.smash.gg/phase_group/" + url.split("/")[-1]
    api_string = "?expand[0]=sets&expand[1]=entrants"
    if api_string not in url:
        url += api_string
    return url