def _normalize_sequence(input, rank, array_type=None):
if isinstance(input, integer_types + (float,)):<EOL><INDENT>normalized = [input] * rank<EOL><DEDENT>else:<EOL><INDENT>normalized = list(input)<EOL>if len(normalized) != rank:<EOL><INDENT>err = "<STR_LIT>"<EOL>raise RuntimeError(err)<EOL><DEDENT><DEDENT>return normalized<EOL>
If input is a scalar, create a sequence of length equal to the
    rank by duplicating the input. If input is a sequence,
    check if its length is equal to the length of array.