code: def isValidUnit(self, w):
          
          bad = set(['point', 'a'])
          if w in bad:
              return False
  
          try:
              pq.Quantity(0.0, w)
              return True
          except:
              return w == '/'
docs: Checks if a string represents a valid quantities unit.
  
          Args:
              w (str): A string to be tested against the set of valid
                  quantities units.
  
          Returns:
              True if the string can be used as a unit in the quantities
              module.