def to_hemi_str(s):
if s is None or s is Ellipsis: return '<STR_LIT>'<EOL>if not pimms.is_str(s): raise ValueError('<STR_LIT>' % s)<EOL>s = s.lower()<EOL>if   s in ('<STR_LIT>',    '<STR_LIT>',  '<STR_LIT>'): return s<EOL>elif s in ('<STR_LIT:left>',  '<STR_LIT:l>',   '<STR_LIT>'): return '<STR_LIT>'<EOL>elif s in ('<STR_LIT:right>', '<STR_LIT:r>',   '<STR_LIT>'): return '<STR_LIT>'<EOL>elif s in ('<STR_LIT>',  '<STR_LIT:all>', '<STR_LIT>'): return '<STR_LIT>'<EOL>else: raise ValueError('<STR_LIT>' % s)<EOL>
to_hemi_str(s) yields either 'lh', 'rh', or 'lr' depending on the input s.

The match rules for s are as follows:
  * if s is None or Ellipsis, returns 'lr'
  * if s is not a string, error; otherwise s becomes s.lower()
  * if s is in ('lh','rh','lr'), returns s
  * if s is in ('left', 'l', 'sh'), returns 'lh'
  * if s is in ('right', 'r', 'dh'), returns 'rh'
  * if s in in ('both', 'all', 'xh'), returns 'lr'
  * otherwise, raises an error