Extract charset from the content type

def get_charset(request):
    """ Extract charset from the content type
    """

    content_type = request.META.get('CONTENT_TYPE', None)
    if content_type:
        return extract_charset(content_type) if content_type else None
    else:
        return None