import requests


def get_shorten_link(long_url, service_url, headers):
    """Return shorten link from url via bit.ly."""
    payload = {"long_url": long_url, "title": "create shorten_link"}
    response = requests.post(
        service_url.format("bitlinks"), headers=headers, json=payload
    )
    response.raise_for_status()
    shorten_link = response.json()["id"]
    return shorten_link