'Returns manifest, stripped of BOMs and UTF-8 decoded, as Python dict.'

@classmethod
def decode_manifest(cls, manifest):

    try:
        data = strip_bom(manifest)
        decoded_data = data.decode('utf-8')
    except (ValueError, UnicodeDecodeError) as exc:
        msg = 'Error    parsing    manifest    (encoding:    utf-8):    %s:    %s'
        log.error((msg % (exc.__class__.__name__, exc)))
        raise forms.ValidationError(_('Could    not    decode    the    webapp    manifest    file.    Check    your    manifest    file    for    special    non-utf-8    characters.'))
    try:
        return json.loads(decoded_data)
    except Exception:
        raise forms.ValidationError(_('The    webapp    manifest    is    not    valid    JSON.'))
