def key_values_as_string(keys, record):
    """Given a dictionary representing a database record, return a nicely
    formatted string contianing the key-value pairs for all of the key
    fields contained in keys.

    """

    key_values = {k: v for k, v in record.items() if k in keys}
    tmp = ["\t{}:{}\n".format(k, v) for k, v in key_values.items()]
    keys_as_string = "".join(tmp)
    return keys_as_string