def integer(x):
    try:
        int(x)
    except (ValueError, TypeError):
        raise ValueError(('%r is not a valid integer' % x))
    else:
        return x
def integer(x):
    try:
        int(x)
    except (ValueError, TypeError):
        raise ValueError(('%r is not a valid integer' % x))
    else:
        return x