I want to convert this snippet 

```
for val in G[k]:
    if val in span[k]:
        result.append((val,col))
    elif val in G[k] and val not in span[k] and S[val][k] != 'col':
        result.append((val,row))

```

into a list comprehension. But this gives me error:

```
[(val,col) if val in span[k] else (val,row) if val in G[k] and val not in span[k] and S[val][k] != 'col' for val in G[k]]

```

So what would be the correct syntax, if there is i.e.