def format_sam_record(record_id, sequence, qualities, tags,
        flag='0', reference_name='*', mapping_position='0', 
        mapping_quality='255', cigar_string='*', reference_name_of_mate='=', 
        position_of_mate='0', template_length='0' ):
    """This formats arguments into a string for outputting as a SAM format
    record. This is missing the ability to handle descriptions or tags other
    than the one indicating which group this is.

    :param record_id: the ID of the read
    :type record_id: str
    :param sequence: the nucleotide sequence to output
    :type sequence: str
    :param qualities: per-base qualities, encoded as letters (ASCII I think)
    :type qualities: str
    :param tags: any tags to add to the tags field, see SAM specification for
        the proper format of these, defaults to blank
    :type tags: str, optional
    :param flag: the bit-flag, defaults to '0'
    :type flag: str, optional
    :param reference_name: name of reference template, defaults to '*'
    :type reference_name: str, optional
    :param mapping_position: mapping position, defaults to '0'
    :type mapping_position: str, optional
    :param mapping_quality: mapping quality, defaults to '255'
    :type mapping_quality: str, optional 
    :param cigar_string: CIGAR string of mutations relative to reference, 
        defaults to '*'
    :type cigar_string: str, optional
    :param reference_name_of_mate: reference name of mate, defaults to '='
    :type reference_name_of_mate: str, optional
    :param position_of_mate: position of mate, defaults to '0'
    :type position_of_mate: str, optional
    :param template_length: length of template, defaults to '0' 
    :type template_length: str, optional

    :return: returns string of the fields, tab-separated for output as a
        SAM record
    :rtype: str
    """

    return "\t".join([ record_id, flag, reference_name, mapping_position, 
            mapping_quality, cigar_string, reference_name_of_mate, 
            position_of_mate, template_length, sequence, qualities, tags ])