Attempt to cast *value* into an integer, returning *default* if it fails.

def _parse_int(value, default=None):
    """
    Attempt to cast *value* into an integer, returning *default* if it fails.
    """
    if value is None:
        return default
    try:
        return int(value)
    except ValueError:
        print "Couldn't cast value to `int`."
        return default