def create_html_select(<EOL>options,<EOL>name=None,<EOL>selected=None,<EOL>disabled=None,<EOL>multiple=False,<EOL>attrs=None,<EOL>**other_attrs):
body = []<EOL>if selected is None:<EOL><INDENT>selected = []<EOL><DEDENT>elif isinstance(selected, (str, unicode)):<EOL><INDENT>selected = [selected]<EOL><DEDENT>if disabled is None:<EOL><INDENT>disabled = []<EOL><DEDENT>elif isinstance(disabled, (str, unicode)):<EOL><INDENT>disabled = [disabled]<EOL><DEDENT>if name is not None and multiple and not name.endswith('<STR_LIT>'):<EOL><INDENT>name += "<STR_LIT>"<EOL><DEDENT>if isinstance(options, dict):<EOL><INDENT>items = options.items()<EOL>items.sort(lambda item1, item2: cmp(item1[<NUM_LIT:1>], item2[<NUM_LIT:1>]))<EOL><DEDENT>elif isinstance(options, (list, tuple)):<EOL><INDENT>options = list(options)<EOL>items = []<EOL>for item in options:<EOL><INDENT>if isinstance(item, (str, unicode)):<EOL><INDENT>items.append((item, item))<EOL><DEDENT>elif isinstance(item, (tuple, list)) and len(item) == <NUM_LIT:2>:<EOL><INDENT>items.append(tuple(item))<EOL><DEDENT>else:<EOL><INDENT>raise ValueError(<EOL>'<STR_LIT>' % (item, type(item)))<EOL><DEDENT><DEDENT><DEDENT>else:<EOL><INDENT>raise ValueError('<STR_LIT>' % type(options))<EOL><DEDENT>for key, value in items:<EOL><INDENT>option_attrs = {}<EOL>if key in selected:<EOL><INDENT>option_attrs['<STR_LIT>'] = '<STR_LIT>'<EOL><DEDENT>if key in disabled:<EOL><INDENT>option_attrs['<STR_LIT>'] = '<STR_LIT>'<EOL><DEDENT>body.append(<EOL>create_tag(<EOL>"<STR_LIT>",<EOL>body=value,<EOL>escape_body=True,<EOL>value=key,<EOL>attrs=option_attrs))<EOL><DEDENT>if attrs is None:<EOL><INDENT>attrs = {}<EOL><DEDENT>if name is not None:<EOL><INDENT>attrs['<STR_LIT:name>'] = name<EOL><DEDENT>if multiple:<EOL><INDENT>attrs['<STR_LIT>'] = '<STR_LIT>'<EOL><DEDENT>return create_tag(<EOL>"<STR_LIT>",<EOL>body='<STR_LIT:\n>'.join(body),<EOL>attrs=attrs,<EOL>**other_attrs)<EOL>
Create an HTML select box.

    >>> print create_html_select(["foo", "bar"], selected="bar", name="baz")
    <select name="baz">
      <option selected="selected" value="bar">
        bar
      </option>
      <option value="foo">
        foo
      </option>
    </select>
    >>> print create_html_select([("foo", "oof"), ("bar", "rab")], selected="bar", name="baz")
    <select name="baz">
      <option value="foo">
        oof
      </option>
      <option selected="selected" value="bar">
        rab
      </option>
    </select>

@param options: this can either be a sequence of strings, or a sequence
    of couples or a map of C{key->value}. In the former case, the C{select}
    tag will contain a list of C{option} tags (in alphabetical order),
    where the C{value} attribute is not specified. In the latter case,
    the C{value} attribute will be set to the C{key}, while the body
    of the C{option} will be set to C{value}.
@type options: sequence or map
@param name: the name of the form element.
@type name: string
@param selected: optional key(s)/value(s) to select by default. In case
    a map has been used for options.
@type selected: string (or list of string)
@param disabled: optional key(s)/value(s) to disable.
@type disabled: string (or list of string)
@param multiple: whether a multiple select box must be created.
@type mutable: bool
@param attrs: optional attributes to create the select tag.
@type attrs: dict
@param other_attrs: other optional attributes.
@return: the HTML output.
@rtype: string

@note: the values and keys will be escaped for HTML.

@note: it is important that parameter C{value} is always
    specified, in case some browser plugin play with the
    markup, for eg. when translating the page.