def METHOD_NAME(rp, CIMCustomerProfile, CIMHostedProfilePage, iframe_communicator_url='', is_secure=False):
    """Get the token from payment gateway for this customer (ex: customer_profile_id=4356210).
       Return token and gateway_error
    """
    gateway_error = False
    site_url = get_setting('site', 'global', 'siteurl')
    if is_secure:
        site_url = site_url.replace('http://', 'https://')
    if not iframe_communicator_url:
        iframe_communicator_url = '%s%s' % (
                                site_url,
                                reverse('recurring_payment.authnet.iframe_communicator'))
    token = ""
    if not rp.customer_profile_id:
        # customer_profile is not available yet for this customer, create one now
        cp = CIMCustomerProfile()
        d = {'email': rp.user.email,
             'description': rp.description,
             'customer_id': str(rp.id)}
        success, response_d = cp.create(**d)
        if success:
            rp.customer_profile_id = response_d['customer_profile_id']
            rp.save()
        else:
            gateway_error = True
            # return since we can't continue without a profile id
            return token, gateway_error
    hosted_profile_page = CIMHostedProfilePage(rp.customer_profile_id)
    hosted_profile_validation_mode = 'liveMode'
    d = {'hosted_profile_settings':
         {'hosted_profile_heading_bg_color': '#e0e0e0',     # the bg color of sections can be customized
          'hosted_profile_card_code_required': 'true',
          'hosted_profile_validation_mode': hosted_profile_validation_mode,
         'hosted_profile_iFrame_communicator_url': '%s' % iframe_communicator_url}}
    success, response_d = hosted_profile_page.get(**d)
    #print success, response_d
    if not success:
        gateway_error = True
    else:
        token = response_d['token']
    return token, gateway_error