<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 def getenv_int(key, default=0):
 """ Get an integer-valued environment variable `key`, if it exists and parses as an integer, otherwise return `default`. """

    try:
        return int(os.environ.get(key, str(default)))
    except ValueError:
        return default