def build_markdown_table(headers, rows, row_keys=None):
    """Build a lined up markdown table.

    Args:
        headers (dict): A key -> value pairing fo the headers.
        rows (list): List of dictionaries that contain all the keys listed in
        the headers.
        row_keys (list): A sorted list of keys to display

    Returns:
        A valid Markdown Table as a string.
    """
    row_maxes = _find_row_maxes(headers, rows)
    row_keys = row_keys or [key for key, value in headers.items()]
    table = [
        _build_row(headers, row_maxes, row_keys),
        _build_separator(row_maxes, row_keys)
    ]

    for row in rows:
        table.append(_build_row(row, row_maxes, row_keys))
    return '\n'.join(table) + '\n'