def get_unit_by_name(self, unit_name: str) -> typing.Optional['<STR_LIT>']:
VALID_STR.validate(unit_name, '<STR_LIT>')<EOL>for unit in self.units:<EOL><INDENT>if unit.unit_name == unit_name:<EOL><INDENT>return unit<EOL><DEDENT><DEDENT>return None<EOL>
Gets a unit from its name

Args:
    unit_name: unit name

Returns: