@classmethod<EOL><INDENT>def from_usi(cls, usi):<DEDENT>
if usi == '<STR_LIT>':<EOL><INDENT>return cls.null()<EOL><DEDENT>elif len(usi) == <NUM_LIT:4>:<EOL><INDENT>if usi[<NUM_LIT:1>] == '<STR_LIT:*>':<EOL><INDENT>piece = Piece.from_symbol(usi[<NUM_LIT:0>])<EOL>return cls(None, SQUARE_NAMES.index(usi[<NUM_LIT:2>:<NUM_LIT:4>]), False, piece.piece_type)<EOL><DEDENT>else:<EOL><INDENT>return cls(SQUARE_NAMES.index(usi[<NUM_LIT:0>:<NUM_LIT:2>]), SQUARE_NAMES.index(usi[<NUM_LIT:2>:<NUM_LIT:4>]))<EOL><DEDENT><DEDENT>elif len(usi) == <NUM_LIT:5> and usi[<NUM_LIT:4>] == '<STR_LIT:+>':<EOL><INDENT>return cls(SQUARE_NAMES.index(usi[<NUM_LIT:0>:<NUM_LIT:2>]), SQUARE_NAMES.index(usi[<NUM_LIT:2>:<NUM_LIT:4>]), True)<EOL><DEDENT>else:<EOL><INDENT>raise ValueError('<STR_LIT>')<EOL><DEDENT>
Parses an USI string.
Raises `ValueError` if the USI string is invalid.