def index_labels_to_array(labels, dtype=None):
if isinstance(labels, (str, tuple)):<EOL><INDENT>labels = [labels]<EOL><DEDENT>if not isinstance(labels, (list, np.ndarray)):<EOL><INDENT>try:<EOL><INDENT>labels = list(labels)<EOL><DEDENT>except TypeError:  <EOL><INDENT>labels = [labels]<EOL><DEDENT><DEDENT>labels = asarray_tuplesafe(labels, dtype=dtype)<EOL>return labels<EOL>
Transform label or iterable of labels to array, for use in Index.

Parameters
----------
dtype : dtype
    If specified, use as dtype of the resulting array, otherwise infer.

Returns
-------
array