def test_get_by_idx(test_idx):
 try:
  test = Test.objects.get(pk=test_idx)
  return test
 except Test.DoesNotExist:
  return None

def test_get_by_idx ( test_idx ) : try : test = Test . objects . get ( pk = test_idx ) return test except Test . DoesNotExist : return None
returns a test based on its index or none .