def to_gps(t, *args, **kwargs):
<EOL>if isinstance(t, string_types):<EOL><INDENT>try:  <EOL><INDENT>float(t)<EOL><DEDENT>except ValueError:  <EOL><INDENT>t = _str_to_datetime(t)<EOL><DEDENT><DEDENT>if isinstance(t, (tuple, list)):<EOL><INDENT>t = datetime.datetime(*t)<EOL><DEDENT>if isinstance(t, datetime.date):<EOL><INDENT>t = _datetime_to_time(t)<EOL><DEDENT>if isinstance(t, Quantity):<EOL><INDENT>t = t.to('<STR_LIT>').value<EOL><DEDENT>if isinstance(t, Decimal):<EOL><INDENT>t = str(t)<EOL><DEDENT>if isinstance(t, Number):<EOL><INDENT>t = repr(t)<EOL><DEDENT>if isinstance(t, Time):<EOL><INDENT>return _time_to_gps(t, *args, **kwargs)<EOL><DEDENT>try:<EOL><INDENT>return LIGOTimeGPS(t)<EOL><DEDENT>except (TypeError, ValueError):<EOL><INDENT>return LIGOTimeGPS(float(t))<EOL><DEDENT>
Convert any input date/time into a `LIGOTimeGPS`.

    Any input object that can be cast as a `~astropy.time.Time`
    (with `str` going through the `datetime.datetime`) are acceptable.

    Parameters
    ----------
    t : `float`, `~datetime.datetime`, `~astropy.time.Time`, `str`
        the input time, any object that can be converted into a
        `LIGOTimeGPS`, `~astropy.time.Time`, or `~datetime.datetime`,
        is acceptable.

    *args, **kwargs
        other arguments to pass to pass to `~astropy.time.Time` if given

    Returns
    -------
    gps : `LIGOTimeGPS`
        the number of GPS seconds (non-integer) since the start of the
        epoch (January 6 1980).

    Raises
    ------
    TypeError
        if a `str` input cannot be parsed as a `datetime.datetime`.
    ValueError
        if the input cannot be cast as a `~astropy.time.Time` or
        `LIGOTimeGPS`.

    Examples
    --------
    >>> to_gps('Jan 1 2017')
    LIGOTimeGPS(1167264018, 0)
    >>> to_gps('Sep 14 2015 09:50:45.391')
    LIGOTimeGPS(1126259462, 391000000)

    >>> import datetime
    >>> to_gps(datetime.datetime(2017, 1, 1))
    LIGOTimeGPS(1167264018, 0)

    >>> from astropy.time import Time
    >>> to_gps(Time(57754, format='mjd'))
    LIGOTimeGPS(1167264018, 0)