def gen_heading(heading_text, depth=1, alternative=False):
    """Creates a Markdown heading.

    This function creates a heading of the given depth. There
    is also an alternative format for the depth 1 and 2.
    A line break is added to the output.

    Args:
      headingText (string): The name of the heading.
      depth (int): The level (depth) of the heading.
      alternative (bool): If this is set to true and the depth is
        1 or 2 then the alternitive fotmat of headings is used.

    Returns:
      string: The heading text formatted as heading.

    """
    if alternative and depth == 1:
        md_str = heading_text + '\n'
        md_str += '=' * len(heading_text)
        return md_str + '\n'
    if alternative and depth is 2:
        md_str = heading_text + '\n'
        md_str += '-' * len(heading_text)
        return md_str + '\n'
    else:
        md_str = '#' * depth
        md_str += ' '
        md_str += heading_text
        return md_str + '\n'
