NUL (0x00) characters in ORM SQLAlchemy

I am sending { company_slug: '\0x00' } using a post request to simulate an internal error.

company_slug = request.form['company_slug']

print company_slug #x00
print type(company_slug) #<type 'str'>
    
company = Company.query.filter_by(slug=company_slug).first()

Then I am getting this error when doing the query:

ValueError: A string literal cannot contain NUL (0x00) characters.

My question is about the correct way to handle this error. A try catch will work, but maybe not the cleaning way?

try:
   company = Company.query.filter_by(slug=company_slug).first()
except:
   pass