def gen_link(url, text='', alt_text=''):
    """Generate a link to an URL.

    Args:
      url (string): The URL for the link.
      text (string): The text to display instead of the URL.
      alt_text (string): The alternative text (usually
        displayed as tool tip).

    Returns:
      string: The URL formatted as Markdown link.

    """
    if text is '' and alt_text is '':
        return url
    elif alt_text is '':
        return '[{}]({})'.format(text, url)
    else:
        return '[{}]({} "{}")'.format(text, url, alt_text)
