'Return credentials from the database.'

def get_credentials(self, filterTerm=None, credtype=None):

    cur = self.conn.cursor()
    if self.is_credential_valid(filterTerm):
        cur.execute('SELECT    *    FROM    credentials    WHERE    id=?    LIMIT    1', [filterTerm])
    elif credtype:
        cur.execute('SELECT    *    FROM    credentials    WHERE    credtype=?', [credtype])
    elif (filterTerm and (filterTerm != '')):
        cur.execute('SELECT    *    FROM    credentials    WHERE    LOWER(username)    LIKE    LOWER(?)', ['%{}%'.format(filterTerm.lower())])
    else:
        cur.execute('SELECT    *    FROM    credentials')
    results = cur.fetchall()
    cur.close()
    return results
