code: def get_unit_by_name(self, unit_name: str) -> typing.Optional['BaseUnit']:
          
          VALID_STR.validate(unit_name, 'get_unit_by_name')
          for unit in self.units:
  
              if unit.unit_name == unit_name:
                  return unit
          return None
docs: Gets a unit from its name
  
          Args:
              unit_name: unit name
  
          Returns: