def METHOD_NAME(scalar_keys, item, identifier, stream):
    scalars, non_scalars = _partition_dict(item, scalar_keys=scalar_keys)
    if scalars:
        if identifier is not None:
            scalars.insert(0, identifier.upper())
        stream.write('\t'.join(scalars))
        stream.write('\n')
    for new_identifier, non_scalar in non_scalars:
        _format_text(item=non_scalar, stream=stream,
                     identifier=new_identifier)