@staticmethod
def _handle_captcha(captcha_data, message=''):
    """ Called when a captcha must be solved
        Writes the image to a temporary file and asks the user to enter the code.

        Args:
            captcha_data: Bytestring of the PNG captcha image.
            message: Optional. A message from Steam service.

        Returns:
            A string containing the solved captcha code.
        """
    from tempfile import NamedTemporaryFile
    tmpf = NamedTemporaryFile(suffix='.png')
    tmpf.write(captcha_data)
    tmpf.flush()
    captcha_text = input(
        'Please take a look at the captcha image "%s" and provide the code:' %
        tmpf.name)
    tmpf.close()
    return captcha_text
