"""Collection of module netural utility functions"""

from sys import stderr
from ssl import SSLError
try:
    from urllib.request import urlopen, HTTPError, URLError
except ImportError:
    from urllib2 import urlopen, HTTPError, URLError

class HTMLGetError(Exception):
    pass

def get_html(url):
    try:
        html = urlopen(url)
    except (HTTPError, URLError, SSLError) as err:
        raise(HTMLGetError(err))

    return html.read().decode('utf-8')


def progress_msg(processed, total):
    """Update user on percent done"""
    if total > 1:
        percent = int((float(processed) / total) * 100)
        stderr.write(
            "\r[%d/%d] %d%%" % (processed, total, percent)
        )
        stderr.flush()


"""Collection of module netural utility functions"""

from sys import stderr
from ssl import SSLError
from socket import timeout
try:
    from urllib.request import urlopen, HTTPError, URLError
except ImportError:
    from urllib2 import urlopen, HTTPError, URLError

class HTMLGetError(Exception):
    pass

def get_html(url):
    try:
        html = urlopen(url)
    except (HTTPError, URLError, SSLError, timeout) as err:
        raise HTMLGetError(err)

    return html.read().decode('utf-8')


def progress_msg(processed, total):
    """Update user on percent done"""
    if total > 1:
        percent = int((float(processed) / total) * 100)
        stderr.write(
            "\r[%d/%d] %d%%" % (processed, total, percent)
        )
        stderr.flush()


Remove superfluous parens; catch timeout
Remove superfluous parens; catch timeout

  """Collection of module netural utility functions"""
  
  from sys import stderr
  from ssl import SSLError
+ from socket import timeout
  try:
      from urllib.request import urlopen, HTTPError, URLError
  except ImportError:
      from urllib2 import urlopen, HTTPError, URLError
  
  class HTMLGetError(Exception):
      pass
  
  def get_html(url):
      try:
          html = urlopen(url)
-     except (HTTPError, URLError, SSLError) as err:
+     except (HTTPError, URLError, SSLError, timeout) as err:
-         raise(HTMLGetError(err))
+         raise HTMLGetError(err)
  
      return html.read().decode('utf-8')
  
  
  def progress_msg(processed, total):
      """Update user on percent done"""
      if total > 1:
          percent = int((float(processed) / total) * 100)
          stderr.write(
              "\r[%d/%d] %d%%" % (processed, total, percent)
          )
          stderr.flush()
  
  
Remove superfluous parens; catch timeout
## Code Before:
"""Collection of module netural utility functions"""

from sys import stderr
from ssl import SSLError
try:
    from urllib.request import urlopen, HTTPError, URLError
except ImportError:
    from urllib2 import urlopen, HTTPError, URLError

class HTMLGetError(Exception):
    pass

def get_html(url):
    try:
        html = urlopen(url)
    except (HTTPError, URLError, SSLError) as err:
        raise(HTMLGetError(err))

    return html.read().decode('utf-8')


def progress_msg(processed, total):
    """Update user on percent done"""
    if total > 1:
        percent = int((float(processed) / total) * 100)
        stderr.write(
            "\r[%d/%d] %d%%" % (processed, total, percent)
        )
        stderr.flush()


## Instruction:
Remove superfluous parens; catch timeout
## Code After:
"""Collection of module netural utility functions"""

from sys import stderr
from ssl import SSLError
from socket import timeout
try:
    from urllib.request import urlopen, HTTPError, URLError
except ImportError:
    from urllib2 import urlopen, HTTPError, URLError

class HTMLGetError(Exception):
    pass

def get_html(url):
    try:
        html = urlopen(url)
    except (HTTPError, URLError, SSLError, timeout) as err:
        raise HTMLGetError(err)

    return html.read().decode('utf-8')


def progress_msg(processed, total):
    """Update user on percent done"""
    if total > 1:
        percent = int((float(processed) / total) * 100)
        stderr.write(
            "\r[%d/%d] %d%%" % (processed, total, percent)
        )
        stderr.flush()

