def dwid_exists(dwid, cursor):
    """See if a dwid exists in the database or not. If yes, return 1,
       if not return 0."""
    array = (dwid,)
    cursor.execute('SELECT * from dwids where dwid=?', array)
    if cursor.fetchone():
        return 1
    else:
        return 0