<commit_before>from binascii import unhexlify

def to_big_endian_binary(val):
    # one (1) hex digit per four (4) bits
    width = val.bit_length()

    # unhexlify wants an even multiple of eight (8) bits, but we don't
    # want more digits than we need (hence the ternary-ish 'or')
    width += 8 - ((width % 8) or 8)

    # format width specifier: four (4) bits per hex digit
    fmt = '%%0%dx' % (width // 4)

    # prepend zero (0) to the width, to zero-pad the output
    return unhexlify(fmt % val)<commit_msg>improve to_big_endian_binary function<commit_after>def to_big_endian_binary(val):
    s = '%x' % val
    if len(s) & 1:
        s = '0' + s
    return s.decode('hex')
{'fraction_non_alphanumeric': 0.11824817518248175, 'fraction_numerical': 0.017518248175182483, 'mean_word_length': 3.059171597633136, 'pattern_counts': {'":': 0, '<': 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': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '5718272', 'n_tokens_mistral': 255, 'n_tokens_neox': 238, 'n_words': 84}