def get_or_create(table, **fields):
	"""
	Returns record from table with passed field values.
	Creates record if it does not exist.
	'table' is a DAL table reference, such as 'db.spot'
	fields are field=value pairs
    Example:
        xpto_spot = get_or_create(db.spot, filename="xptoone.swf", \
                description="", time=30, position=2, uploader="admin", \
                timestamp = datetime.now())
	"""
	return table(**fields) or table.insert(**fields)