def uid_exists(uid):
    """Check if a uid exists"""
    try:
        pwd.getpwuid(uid)
        uid_exists = True
    except KeyError:
        uid_exists = False
    return uid_exists
Check if a uid exists