code: def _convert(val, acceptable_types):
    
    if isinstance(val, acceptable_types):
      return val
    return parse_expression(val, acceptable_types, raise_type=ParseError)
docs: Ensure that val is one of the acceptable types, converting it if needed.
  
    :param val: The value we're parsing (either a string or one of the acceptable types).
    :param acceptable_types: A tuple of expected types for val.
    :returns: The parsed value.
    :raises :class:`pants.options.errors.ParseError`: if there was a problem parsing the val as an
                                                      acceptable type.