parameters: (email_id, analyst, data_format)
return_statement: return HttpResponse(json.dumps(data), content_type="application/json")
docstring: Format an email in YAML or JSON.
  
      :param email_id: The ObjectId of the email.
      :type email_id: str
      :param analyst: The user requesting the data.
      :type analyst: str
      :param data_format: The format you want the data in.
      :type data_format: "json" or "yaml"
      :returns: :class:`django.http.HttpResponse`
docstring_summary: Format an email in YAML or JSON.
docstring_tokens: Format an email in YAML or JSON .
function: def get_email_formatted(email_id, analyst, data_format):
      """
      Format an email in YAML or JSON.
  
      :param email_id: The ObjectId of the email.
      :type email_id: str
      :param analyst: The user requesting the data.
      :type analyst: str
      :param data_format: The format you want the data in.
      :type data_format: "json" or "yaml"
      :returns: :class:`django.http.HttpResponse`
      """
  
      sources = user_sources(analyst)
      email = Email.objects(id=email_id, source__name__in=sources).first()
      if not email:
          return HttpResponse(json.dumps({}), content_type="application/json")
      exclude = [
                  "created",
                  "source",
                  "relationships",
                  "schema_version",
                  "campaign",
                  "analysis",
                  "bucket_list",
                  "ticket",
                  "releasability",
                  "unsupported_attrs",
                  "status",
                  "objects",
                  "modified",
                  "analyst",
                  "_id",
                  "to",
                  "cc",
                  "raw_headers",
                ]
      if data_format == "yaml":
          data = {"email_yaml": email.to_yaml(exclude=exclude)}
      elif data_format == "json":
          data = {"email_yaml": email.to_json(exclude=exclude)}
      else:
          data = {"email_yaml": {}}
      return HttpResponse(json.dumps(data), content_type="application/json")
function_tokens: def get_email_formatted ( email_id , analyst , data_format ) : sources = user_sources ( analyst ) email = Email . objects ( id = email_id , source__name__in = sources ) . first ( ) if not email : return HttpResponse ( json . dumps ( { } ) , content_type = "application/json" ) exclude = [ "created" , "source" , "relationships" , "schema_version" , "campaign" , "analysis" , "bucket_list" , "ticket" , "releasability" , "unsupported_attrs" , "status" , "objects" , "modified" , "analyst" , "_id" , "to" , "cc" , "raw_headers" , ] if data_format == "yaml" : data = { "email_yaml" : email . to_yaml ( exclude = exclude ) } elif data_format == "json" : data = { "email_yaml" : email . to_json ( exclude = exclude ) } else : data = { "email_yaml" : { } } return HttpResponse ( json . dumps ( data ) , content_type = "application/json" )