code: def get_depts(self, dept_name=None):
          
          depts = self.json_response.get("department", None)
          params = self.kwargs.get("params", None)
          fetch_child = params.get("fetch_child", True) if params else True
          if dept_name is not None:
              depts = [dept for dept in depts if dept["name"] == dept_name]
          depts = [{"id": dept["id"], "name": dept["name"]} for dept in depts]
          self.logger.info("%s\t%s" % (self.request_method, self.request_url))
          return depts if fetch_child else depts[0]
docs: Method to get department by name.