Utility functions for Erlang ports