use duck typing instead of explicitly checking for a lambda