def dict_to_rows(data, main_key_name=None, main_key_position=None,
    if_empty_value=None, order=None):
    """
    Convert a dictionary to rows (list(lists))

    Parameters
    ----------
    data : dict
        the data to convert in form of a dictionary
    main_key_name : str, optional
        if the data isn't provided as `{main_key: data}` the key needs to be specified
    main_key_position : int, optional
        if the main_key shall not be on top left of the data the position can be specified
    if_empty_value : any, optional
        if a main_key's sub_key is not set something different than `blank` can be defined
    order : dict, list, None, optional
        if a special order for the keys is required

    Returns
    -------
    list(lists)
        list of rows representing the csv based on the `main_element_position`

    """
    if not main_key_name:
        from ._helper import _cast_main_key_name
        data, main_key_name = _cast_main_key_name(data)
    header_keys = set()
    try:
        for main_key in data:
            for key in data[main_key].keys():
                header_keys.add(key)
    except AttributeError:
        raise ValueError(
            'JSON/dictionary is not formatted suitable for neat csv conversion. {main_element: {key: {value_key: value}}} expected'
            )
    if not order:
        header = list(header_keys)
        header.insert(main_key_position if main_key_position else 0,
            main_key_name)
    else:
        from ._helper import _create_sorted_list_from_order
        header = _create_sorted_list_from_order(all_elements=header_keys,
            order=order, main_element=main_key_name, main_element_position=
            main_key_position)
    header_without_ordered_keys = header.copy()
    header_without_ordered_keys.remove(main_key_name)
    rows = [header]
    for element in data:
        row = [(data[element][key] if key in data[element] else
            if_empty_value) for key in header_without_ordered_keys]
        row.insert(main_key_position if main_key_position else 0, element)
        rows.append(row)
    return rows
