code: def __get_category_id(self, name):
          
  
          query = """
                     SELECT id from categories
                      WHERE lower(name) = lower(?)
                   ORDER BY id desc
                      LIMIT 1
          """
  
          res = self.fetchone(query, (name, ))
  
          if res:
              return res['id']
  
          return None
docs: returns category by it's name