code: def assert_valid_input(cls, tag):
          
  
          # Fail on unexpected types.
          if not cls.is_tag(tag):
              raise TypeError("Expected a BeautifulSoup 'Tag', but instead recieved type {}".format(type(tag)))
docs: Check if valid input tag or document.