Is there a one-liner to handle the following scenario:

```
def queryByAttr(attr1,attr2=None):
  if attr2 is None:
    session.query(Foo).filter(Foo.attr1==attr1)
  else:
    session.query(Foo).filter(Foo.attr1==attr1).filter(Foo.attr2==attr2)

```