ported from pycogent backports to include new option types
updated credits