def func(objname=None, objtype=None):
    if [objname, objtype].count(None) != 1:
        raise TypeError('Exactly 1 of the ways must be used.')
if objname is not None:
    obj = getObjByName(objname)
else:
    obj = getObjByType(objtype)
Elegant pattern for mutually exclusive keyword args?