<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 def create_emergency_codes(self, code=None):
 """Generate emergency codes :param code: SMS code :type code: str :raises: :class:`SteamAuthenticatorError` :return: list of codes :rtype: list .. note:: A confirmation code is required to generate emergency codes and this method needs to be called twice as shown below. .. code:: python sa.create_emergency_codes() # request a SMS code sa.create_emergency_codes(code='12345') # creates emergency codes """

        if code:
            return self._send_request('createemergencycodes', {'code': code}).get('codes', [])
        else:
            self._send_request('createemergencycodes', {})
            return None