def build_ins_query(table, columns, returns=None):
    """Takes a table name, a list of columns and optional colunns to return after the
    insert is complete

    Args:
        table (str): table to insert into
        columns (list of str): ordered list of column names
        return (list of str): inserted column values you wish to return

    Returns:
        str: formated query
    """
    qry = 'INSERT INTO {table} {columns_str} VALUES {values_str}'
    qry_strs = {
        'columns_str': '(' + ','.join(columns) + ')',
        'values_str': '(' + ','.join(('%(' + col + ')s' for col in columns)) + ')'
    }
    if returns:
        qry += ' RETURNING {returns_str}'
        qry_strs['returns_str'] = '(' + ','.join(returns) + ')'
    fmtd_qry = qry.format(table=table, **qry_strs)
    return fmtd_qry