code: def flatten(dictionary, separator='.', prefix=''):
      
      new_dict = {}
      for key, value in dictionary.items():
          new_key = prefix + separator + key if prefix else key
          if isinstance(value, collections.MutableMapping):
              new_dict.update(flatten(value, separator, new_key))
  
          elif isinstance(value, list):
              new_value = []
              for item in value:
                  if isinstance(item, collections.MutableMapping):
                      new_value.append(flatten(item, separator, new_key))
                  else:
                      new_value.append(item)
              new_dict[new_key] = new_value
  
          else:
              new_dict[new_key] = value
  
      return new_dict
docs: Flatten the dictionary keys are separated by separator
  
      Arguments:
          dictionary {dict} -- The dictionary to be flattened.
  
      Keyword Arguments:
          separator {str} -- The separator to use (default is '.'). It will
          crush items with key conflicts.
          prefix {str} -- Used for recursive calls.
  
      Returns:
          dict -- The flattened dictionary.