def guess_mime_type(content, deftype):
    #Mappings recognized by cloudinit
    starts_with_mappings={
        '#include' : 'text/x-include-url',
        '#!' : 'text/x-shellscript',
        '#cloud-config' : 'text/cloud-config',
        '#upstart-job'  : 'text/upstart-job',
        '#part-handler' : 'text/part-handler',
        '#cloud-boothook' : 'text/cloud-boothook'
    }
    rtype = deftype
    for possible_type,mimetype in starts_with_mappings.items():
        if content.startswith(possible_type):
            rtype = mimetype
            break
    return(rtype)
Description: Guess the mime type of a block of text
dataset/ETHPy150Open radlab/sparrow/deploy/third_party/boto-2.1.1/boto/utils.py/guess_mime_type