<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 def process_input(netIn, allowedformats, outputformat='G'):
 """ Takes input network and checks what the input is. Parameters netIn : array, dict, or TemporalNetwork Network (graphlet, contact or object) allowedformats : str Which format of network objects that are allowed. Options: 'C', 'TN', 'G'. outputformat: str, default=G Target output format. Options: 'C' or 'G'. Returns ------- C : dict OR G : array Graphlet representation. netInfo : dict Metainformation about network. OR tnet : object object of TemporalNetwork class """

    inputtype = checkInput(netIn)
    # Convert TN to G representation
    if inputtype == 'TN' and 'TN' in allowedformats and outputformat != 'TN':
        G = netIn.df_to_array()
        netInfo = {'nettype': netIn.nettype, 'netshape': netIn.netshape}
    elif inputtype == 'TN' and 'TN' in allowedformats and outputformat == 'TN':
        TN = netIn
    elif inputtype == 'C' and 'C' in allowedformats and outputformat == 'G':
        G = contact2graphlet(netIn)
        netInfo = dict(netIn)
        netInfo.pop('contacts')
    elif inputtype == 'C' and 'C' in allowedformats and outputformat == 'TN':
        TN = TemporalNetwork(from_dict=netIn)
    elif inputtype == 'G' and 'G' in allowedformats and outputformat == 'TN':
        TN = TemporalNetwork(from_array=netIn)
    # Get network type if not set yet
    elif inputtype == 'G' and 'G' in allowedformats:
        netInfo = {}
        netInfo['netshape'] = netIn.shape
        netInfo['nettype'] = gen_nettype(netIn)
        G = netIn
    elif inputtype == 'C' and outputformat == 'C':
        pass
    else:
        raise ValueError('Input invalid.')
    if outputformat == 'TN' and not isinstance(TN.network, str):
        TN.network['i'] = TN.network['i'].astype(int)
        TN.network['j'] = TN.network['j'].astype(int)
        TN.network['t'] = TN.network['t'].astype(int)
    if outputformat == 'C' or outputformat == 'G':
        netInfo['inputtype'] = inputtype
    if inputtype != 'C' and outputformat == 'C':
        C = graphlet2contact(G, netInfo)
    if outputformat == 'G':
        return G, netInfo
    elif outputformat == 'C':
        return C
    elif outputformat == 'TN':
        return TN