join filter bool parent key join for in parent key if

1
2
3
'_'.join(filter(bool, [parent, key]))
'_'.join(x for x in [parent, key] if x)