<commit_before>def object2string(message):
    whole_message =  _generate_message_from_object(message)
    return whole_message




def _generate_message_from_object(message):
    whole_message = ""
    message.header.reverse()
    message.ie.reverse()
    for i,j in izip_l(message.items, message.items[1:]):
    #TODO: this is looking bad. try to do something about it
        if i == 'Header':
            whole_message += _return_header_from_obj(message)
            if j != 'Header':
                whole_message += '\r\n'
        elif i == 'IE':
            whole_message += _return_ie_from_obj(message)
        else:
            raise Exception(NameError, 'Unwknown type %s' %i)
        if j == None:
            whole_message += '\r\n'
    return whole_message

def izip_l(x,y):
    pad = lambda l1,l2: l1 + [None for _ in range(max(len(l2) -
                                                      len(l1), 0))]
    return zip(pad(x,y), pad(y,x))

def _return_header_from_obj(message):
    _, header = message.header.pop()
    return header + " "



def _return_ie_from_obj(message):
    ie = message.ie.pop()
    return ": ".join(ie) + "\r\n"<commit_msg>clean<commit_after>def object2string(message):
    whole_message =  _generate_message_from_object(message)
    return whole_message




def _generate_message_from_object(message):
    whole_message = ""
    message.header.reverse()
    message.ie.reverse()
    for i,j in izip_l(message.items, message.items[1:]):
    #TODO: this is looking bad. try to do something about it
        if i == 'Header':
            whole_message += _return_header_from_obj(message)
            if j != 'Header':
                whole_message += '\r\n'
        elif i == 'IE':
            whole_message += _return_ie_from_obj(message)
        else:
            raise Exception(NameError, 'Unwknown type %s' %i)

    whole_message += '\r\n'
    return whole_message

def izip_l(x,y):
    pad = lambda l1,l2: l1 + [None for _ in range(max(len(l2) -
                                                      len(l1), 0))]
    return zip(pad(x,y), pad(y,x))

def _return_header_from_obj(message):
    _, header = message.header.pop()
    return header + " "

def _return_ie_from_obj(message):
    ie = message.ie.pop()
    return ": ".join(ie) + "\r\n"
{'fraction_non_alphanumeric': 0.12286838653257542, 'fraction_numerical': 0.006996064713598601, 'mean_word_length': 2.3352769679300294, 'pattern_counts': {'":': 2, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 4, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '7114712', 'n_tokens_mistral': 749, 'n_tokens_neox': 733, 'n_words': 164}