def parseInt(s, ret=0):
    """Parses a value as int."""
    if not isinstance(s, str):
        return int(s)
    elif s:
        if s[0] in "+-":
            ts = s[1:]
        else:
            ts = s

        if ts and all([_ in "0123456789" for _ in ts]):
            return int(s)

    return ret