def to_time(arg, format=None, infer_time_format=False, errors='<STR_LIT>'):
def _convert_listlike(arg, format):<EOL><INDENT>if isinstance(arg, (list, tuple)):<EOL><INDENT>arg = np.array(arg, dtype='<STR_LIT:O>')<EOL><DEDENT>elif getattr(arg, '<STR_LIT>', <NUM_LIT:1>) > <NUM_LIT:1>:<EOL><INDENT>raise TypeError('<STR_LIT>'<EOL>'<STR_LIT>')<EOL><DEDENT>arg = ensure_object(arg)<EOL>if infer_time_format and format is None:<EOL><INDENT>format = _guess_time_format_for_array(arg)<EOL><DEDENT>times = []<EOL>if format is not None:<EOL><INDENT>for element in arg:<EOL><INDENT>try:<EOL><INDENT>times.append(datetime.strptime(element, format).time())<EOL><DEDENT>except (ValueError, TypeError):<EOL><INDENT>if errors == '<STR_LIT>':<EOL><INDENT>msg = ("<STR_LIT>"<EOL>"<STR_LIT>").format(element=element,<EOL>format=format)<EOL>raise ValueError(msg)<EOL><DEDENT>elif errors == '<STR_LIT:ignore>':<EOL><INDENT>return arg<EOL><DEDENT>else:<EOL><INDENT>times.append(None)<EOL><DEDENT><DEDENT><DEDENT><DEDENT>else:<EOL><INDENT>formats = _time_formats[:]<EOL>format_found = False<EOL>for element in arg:<EOL><INDENT>time_object = None<EOL>for time_format in formats:<EOL><INDENT>try:<EOL><INDENT>time_object = datetime.strptime(element,<EOL>time_format).time()<EOL>if not format_found:<EOL><INDENT>fmt = formats.pop(formats.index(time_format))<EOL>formats.insert(<NUM_LIT:0>, fmt)<EOL>format_found = True<EOL><DEDENT>break<EOL><DEDENT>except (ValueError, TypeError):<EOL><INDENT>continue<EOL><DEDENT><DEDENT>if time_object is not None:<EOL><INDENT>times.append(time_object)<EOL><DEDENT>elif errors == '<STR_LIT>':<EOL><INDENT>raise ValueError("<STR_LIT>"<EOL>"<STR_LIT>".format(arg=arg))<EOL><DEDENT>elif errors == '<STR_LIT:ignore>':<EOL><INDENT>return arg<EOL><DEDENT>else:<EOL><INDENT>times.append(None)<EOL><DEDENT><DEDENT><DEDENT>return times<EOL><DEDENT>if arg is None:<EOL><INDENT>return arg<EOL><DEDENT>elif isinstance(arg, time):<EOL><INDENT>return arg<EOL><DEDENT>elif isinstance(arg, ABCSeries):<EOL><INDENT>values = _convert_listlike(arg._values, format)<EOL>return arg._constructor(values, index=arg.index, name=arg.name)<EOL><DEDENT>elif isinstance(arg, ABCIndexClass):<EOL><INDENT>return _convert_listlike(arg, format)<EOL><DEDENT>elif is_list_like(arg):<EOL><INDENT>return _convert_listlike(arg, format)<EOL><DEDENT>return _convert_listlike(np.array([arg]), format)[<NUM_LIT:0>]<EOL>
Parse time strings to time objects using fixed strptime formats ("%H:%M",
"%H%M", "%I:%M%p", "%I%M%p", "%H:%M:%S", "%H%M%S", "%I:%M:%S%p",
"%I%M%S%p")

Use infer_time_format if all the strings are in the same format to speed
up conversion.

Parameters
----------
arg : string in time format, datetime.time, list, tuple, 1-d array,  Series
format : str, default None
    Format used to convert arg into a time object.  If None, fixed formats
    are used.
infer_time_format: bool, default False
    Infer the time format based on the first non-NaN element.  If all
    strings are in the same format, this will speed up conversion.
errors : {'ignore', 'raise', 'coerce'}, default 'raise'
    - If 'raise', then invalid parsing will raise an exception
    - If 'coerce', then invalid parsing will be set as None
    - If 'ignore', then invalid parsing will return the input

Returns
-------
datetime.time