code: def filter(criterias, devices):  # pylint: disable=too-many-branches
          
          if not criterias:
              return devices
          result = []
          for device in devices:  # pylint: disable=too-many-nested-blocks
              for criteria_name, criteria_values in criterias.items():
                  if criteria_name in device.keys():
                      if isinstance(device[criteria_name], list):
                          for criteria_value in criteria_values:
                              if criteria_value in device[criteria_name]:
                                  result.append(device)
                                  break
                      elif isinstance(device[criteria_name], str):
                          for criteria_value in criteria_values:
                              if criteria_value == device[criteria_name]:
                                  result.append(device)
                      elif isinstance(device[criteria_name], int):
                          for criteria_value in criteria_values:
                              if criteria_value == device[criteria_name]:
                                  result.append(device)
                      else:
                          continue
          return result
docs: Filter a device by criterias on the root level of the dictionary.