'Return hosts from the database.'

def get_computers(self, filterTerm=None, domain=None):

    cur = self.conn.cursor()
    if self.is_computer_valid(filterTerm):
        cur.execute('SELECT    *    FROM    computers    WHERE    id=?    LIMIT    1', [filterTerm])
    elif (filterTerm == 'dc'):
        if domain:
            cur.execute('SELECT    *    FROM    computers    WHERE    dc=1    AND    LOWER(domain)=LOWER(?)', [domain])
        else:
            cur.execute('SELECT    *    FROM    computers    WHERE    dc=1')
    elif (filterTerm and (filterTerm != '')):
        cur.execute('SELECT    *    FROM    computers    WHERE    ip    LIKE    ?    OR    LOWER(hostname)    LIKE    LOWER(?)', ['%{}%'.format(filterTerm), '%{}%'.format(filterTerm)])
    else:
        cur.execute('SELECT    *    FROM    computers')
    results = cur.fetchall()
    cur.close()
    return results
