code: def dict_to_df(desired_type: Type[T], dict_obj: Dict, logger: Logger, orient: str = None, **kwargs) -> pd.DataFrame:
      
  
      if len(dict_obj) > 0:
          first_val = dict_obj[next(iter(dict_obj))]
          if isinstance(first_val, dict) or isinstance(first_val, list):
              # --'full' table
  
              # default is index orientation
              orient = orient or 'index'
  
              # if orient is 'columns':
              #     return pd.DataFrame(dict_obj)
              # else:
              return pd.DataFrame.from_dict(dict_obj, orient=orient)
          else:
              # --scalar > single-row or single-col
  
              # default is columns orientation
              orient = orient or 'columns'
  
              if orient is 'columns':
                  return pd.DataFrame(dict_obj, index=[0])
              else:
                  res = pd.DataFrame.from_dict(dict_obj, orient=orient)
                  res.index.name = 'key'
                  return res.rename(columns={0: 'value'})
      else:
          # for empty dictionaries, orientation does not matter
          # but maybe we should still create a column 'value' in this empty dataframe ?
          return pd.DataFrame.from_dict(dict_obj)
docs: 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: