def get_parameter(store, name, klass=None):
    """Returns the parameter value given its name

    :param klass: if this parameter is a reference to another table, an instance
      of this klass will be returned.
    """
    res = store.execute(
        """SELECT field_value FROM parameter_data WHERE
                                    field_name = ?"""
        , (name,)).get_one()
    if not res:
        return None
    field_value = res[0]
    if klass:
        return store.find(klass, id=int(field_value)).one()
    return field_value
