def format_array(values, formatter, float_format=None, na_rep='<STR_LIT>',<EOL>digits=None, space=None, justify='<STR_LIT:right>', decimal='<STR_LIT:.>',<EOL>leading_space=None):
if is_datetime64_dtype(values.dtype):<EOL><INDENT>fmt_klass = Datetime64Formatter<EOL><DEDENT>elif is_datetime64tz_dtype(values):<EOL><INDENT>fmt_klass = Datetime64TZFormatter<EOL><DEDENT>elif is_timedelta64_dtype(values.dtype):<EOL><INDENT>fmt_klass = Timedelta64Formatter<EOL><DEDENT>elif is_extension_array_dtype(values.dtype):<EOL><INDENT>fmt_klass = ExtensionArrayFormatter<EOL><DEDENT>elif is_float_dtype(values.dtype) or is_complex_dtype(values.dtype):<EOL><INDENT>fmt_klass = FloatArrayFormatter<EOL><DEDENT>elif is_integer_dtype(values.dtype):<EOL><INDENT>fmt_klass = IntArrayFormatter<EOL><DEDENT>else:<EOL><INDENT>fmt_klass = GenericArrayFormatter<EOL><DEDENT>if space is None:<EOL><INDENT>space = get_option("<STR_LIT>")<EOL><DEDENT>if float_format is None:<EOL><INDENT>float_format = get_option("<STR_LIT>")<EOL><DEDENT>if digits is None:<EOL><INDENT>digits = get_option("<STR_LIT>")<EOL><DEDENT>fmt_obj = fmt_klass(values, digits=digits, na_rep=na_rep,<EOL>float_format=float_format, formatter=formatter,<EOL>space=space, justify=justify, decimal=decimal,<EOL>leading_space=leading_space)<EOL>return fmt_obj.get_result()<EOL>
Format an array for printing.

Parameters
----------
values
formatter
float_format
na_rep
digits
space
justify
decimal
leading_space : bool, optional
    Whether the array should be formatted with a leading space.
    When an array as a column of a Series or DataFrame, we do want
    the leading space to pad between columns.

    When formatting an Index subclass
    (e.g. IntervalIndex._format_native_types), we don't want the
    leading space since it should be left-aligned.

Returns
-------
List[str]