Usually better to avoid negation (makes logic easier to follow), so:

if function(data):
  return True
print error message
return False