def dict_to_df(desired_type: Type[T], dict_obj: Dict, logger: Logger, orient: str = None, **kwargs) -> pd.DataFrame:
if len(dict_obj) > <NUM_LIT:0>:<EOL><INDENT>first_val = dict_obj[next(iter(dict_obj))]<EOL>if isinstance(first_val, dict) or isinstance(first_val, list):<EOL><INDENT>orient = orient or '<STR_LIT:index>'<EOL>return pd.DataFrame.from_dict(dict_obj, orient=orient)<EOL><DEDENT>else:<EOL><INDENT>orient = orient or '<STR_LIT>'<EOL>if orient is '<STR_LIT>':<EOL><INDENT>return pd.DataFrame(dict_obj, index=[<NUM_LIT:0>])<EOL><DEDENT>else:<EOL><INDENT>res = pd.DataFrame.from_dict(dict_obj, orient=orient)<EOL>res.index.name = '<STR_LIT:key>'<EOL>return res.rename(columns={<NUM_LIT:0>: '<STR_LIT:value>'})<EOL><DEDENT><DEDENT><DEDENT>else:<EOL><INDENT>return pd.DataFrame.from_dict(dict_obj)<EOL><DEDENT>
Helper method to convert a dictionary into a dataframe. It supports both simple key-value dicts as well as true
table dicts. For this it uses pd.DataFrame constructor or pd.DataFrame.from_dict intelligently depending on the
case.

The orientation of the resulting dataframe can be configured, or left to default behaviour. Default orientation is
different depending on the contents:
* 'index' for 2-level dictionaries, in order to align as much as possible with the natural way to express rows in
JSON
* 'columns' for 1-level (simple key-value) dictionaries, so as to preserve the data types of the scalar values in
the resulting dataframe columns if they are different

:param desired_type:
:param dict_obj:
:param logger:
:param orient: the orientation of the resulting dataframe.
:param kwargs:
:return: