def fix_ra_dec(ra, dec):
    """
    Wraps input RA and DEC values into range expected by the extensions.

    Parameters
    ------------
    RA: array-like, units must be degrees
       Right Ascension values (astronomical longitude)

    DEC: array-like, units must be degrees
       Declination values (astronomical latitude)

    Returns
    --------
    Tuple (RA, DEC): array-like
         RA is wrapped into range [0.0, 360.0]
         Declination is wrapped into range [-90.0, 90.0]

    """
    try:
        input_dtype = ra.dtype
    except:
        msg = 'Input RA array must be a numpy array'
        raise TypeError(msg)
    if ra is None or dec is None:
        msg = 'RA or DEC must be valid arrays'
        raise ValueError(msg)
    if min(ra) < 0.0:
        print(
            'Warning: found negative RA values, wrapping into [0.0, 360.0]  range'
            )
        ra += 180.0
    if max(dec) > 90.0:
        print(
            'Warning: found DEC values more than 90.0; wrapping into [-90.0, 90.0] range'
            )
        dec += 90.0
    return ra.astype(input_dtype), dec.astype(input_dtype)
