def set_checksum_args(arguments):
    """
    Argparse parses checksums as {'checksum_sha256': '<sha256_hash>'}

    Return a list of these arguments in a format the Identifiers Service
    understands:

    "checksums": [
      {
        "function": "md5",
        "value": "fobarbas"
      },
      {
        "function": "sha256",
        "value": "foobarbaz"
      }
    ],

    Note: This modifies the values in 'arguments'
    """
    checksum_args = [
        {'function': arg_name.replace('checksum_', '').replace('_', '-'),
         'value': arguments.pop(arg_name)}
        for arg_name in list(arguments.keys())
        if arg_name.startswith('checksum') and arguments[arg_name] is not None
    ]
    if checksum_args:
        arguments['checksums'] = checksum_args
    return arguments