= 1, green = 2, blue = 4 };

color identity_(color x) { return x; }

BOOST_PYTHON_MODULE(enums)
{
    enum_&lt;color&gt;(&quot;color&quot;)
        .value(&quot;red&quot;, red)
        .value(&quot;green&quot;, green)
        .export_values()
        .value(&quot;blue&quot;, blue)
        ;
    
    def(&quot;identity&quot;, identity_);
}
</pre>
    <p>Interactive Python:
<pre>
&gt;&gt;&gt; from enums import *

&gt;&gt;&gt; identity(red)
enums.color.red

&gt;&gt;&gt; identity(color.red)
enums.color.red

&gt