def _get_deep(data_structure, dot_path_or_list, default_value=None):
 search_path = None
 param_type = type(dot_path_or_list)
 if (param_type in (tuple, list)):
  search_path = dot_path_or_list
 elif (param_type == str):
  search_path = dot_path_or_list.split('.')
 assert (len(search_path) > 0), 'Missing valid search path'
 try:
  current_item = data_structure
  for search_key in search_path:
   current_item = current_item[search_key]
 except (KeyError, IndexError, TypeError):
  return default_value
 return current_item

def _get_deep ( data_structure , dot_path_or_list , default_value = None ) : search_path = None param_type = type ( dot_path_or_list ) if ( param_type in ( tuple , list ) ) : search_path = dot_path_or_list elif ( param_type == str ) : search_path = dot_path_or_list . split ( '.' ) assert ( len ( search_path ) > 0 ) , 'Missing valid search path' try : current_item = data_structure for search_key in search_path : current_item = current_item [ search_key ] except ( KeyError , IndexError , TypeError ) : return default_value return current_item
attempts access nested data structures and not blow up on a gross key error "hello": { "hi": 5 .