def dec2sex(rain,decin,as_string=False,decimal_places=2):
    """
    Converts decimal coordinates to sexagesimal.
    
    Parameters
    ----------
    rain : float
        Input Right Ascension in decimal -- e.g.,  12.34567
    decin : float
        input Declination in decimal -- e.g. -34.56789
    as_string : bool
        Specifies whether to return output as a string (useful for making tables)
    decimal_places : int 
        Number of decimals places to use when as_string=True
    
    Returns
    -------
    list
        ['HH:MM:SS.ss', 'DD:MM:SS.ss']
    """
    rmins,rsec=divmod(24./360*rain*3600,60)
    rh,rmins=divmod(rmins,60)
    #dmins,dsec=divmod(decin*3600,60)
    #ddeg,dmins=divmod(dmins,60)
    ddeg=int(decin)
    dmins=int(abs(decin-ddeg)*60)
    dsec=(abs((decin-ddeg)*60)-dmins)*60
    if as_string==True: return ['{0}:{1}:{2:0>{4}.{3}f}'.format(int(rh),int(rmins),rsec,decimal_places,decimal_places+3),'{0}:{1}:{2:0>{4}.{3}f}'.format(int(ddeg),int(dmins),dsec,decimal_places,decimal_places+3)]
    else: return [int(rh),int(rmins),rsec],[int(ddeg),int(dmins),dsec]