def playstate(state):
<EOL>if state is None:<EOL><INDENT>return const.PLAY_STATE_NO_MEDIA<EOL><DEDENT>if state == <NUM_LIT:0>:<EOL><INDENT>return const.PLAY_STATE_IDLE<EOL><DEDENT>if state == <NUM_LIT:1>:<EOL><INDENT>return const.PLAY_STATE_LOADING<EOL><DEDENT>if state == <NUM_LIT:3>:<EOL><INDENT>return const.PLAY_STATE_PAUSED<EOL><DEDENT>if state == <NUM_LIT:4>:<EOL><INDENT>return const.PLAY_STATE_PLAYING<EOL><DEDENT>if state == <NUM_LIT:5>:<EOL><INDENT>return const.PLAY_STATE_FAST_FORWARD<EOL><DEDENT>if state == <NUM_LIT:6>:<EOL><INDENT>return const.PLAY_STATE_FAST_BACKWARD<EOL><DEDENT>raise exceptions.UnknownPlayState('<STR_LIT>' + str(state))<EOL>
Convert iTunes playstate to API representation.