@staticmethod
def convert_doc_to_pb(doc, pb):
    '\n        Convert policy from database document to protobuf.\n\n        :param dict doc: Database document.\n        :param pb: An empty protobuf.\n        :type pb: starbelly.starbelly_pb2.Policy\n        '
    if ('id' in doc):
        pb.policy_id = UUID(doc['id']).bytes
    pb.name = doc['name']
    pb.created_at = doc['created_at'].isoformat()
    pb.updated_at = doc['updated_at'].isoformat()
    PolicyAuthentication.convert_doc_to_pb(doc.get('authentication', dict()), pb.authentication)
    if (doc.get('captcha_solver_id') is not None):
        pb.captcha_solver_id = UUID(doc['captcha_solver_id']).bytes
    PolicyLimits.convert_doc_to_pb(doc.get('limits', dict()), pb.limits)
    PolicyMimeTypeRules.convert_doc_to_pb(doc.get('mime_type_rules', list()), pb.mime_type_rules)
    PolicyProxyRules.convert_doc_to_pb(doc.get('proxy_rules', list()), pb.proxy_rules)
    PolicyRobotsTxt.convert_doc_to_pb(doc.get('robots_txt', dict()), pb.robots_txt)
    PolicyUrlNormalization.convert_doc_to_pb(doc.get('url_normalization', dict()), pb.url_normalization)
    PolicyUrlRules.convert_doc_to_pb(doc.get('url_rules', list()), pb.url_rules)
    PolicyUserAgents.convert_doc_to_pb(doc.get('user_agents', list()), pb.user_agents)
Convert policy from database document to protobuf.

:param dict doc: Database document.
:param pb: An empty protobuf.
:type pb: starbelly.starbelly_pb2.Policy
@staticmethod
def convert_doc_to_pb(doc, pb):
    '\n        Convert policy from database document to protobuf.\n\n        :param dict doc: Database document.\n        :param pb: An empty protobuf.\n        :type pb: starbelly.starbelly_pb2.Policy\n        '
    if ('id' in doc):
        pb.policy_id = UUID(doc['id']).bytes
    pb.name = doc['name']
    pb.created_at = doc['created_at'].isoformat()
    pb.updated_at = doc['updated_at'].isoformat()
    PolicyAuthentication.convert_doc_to_pb(doc.get('authentication', dict()), pb.authentication)
    if (doc.get('captcha_solver_id') is not None):
        pb.captcha_solver_id = UUID(doc['captcha_solver_id']).bytes
    PolicyLimits.convert_doc_to_pb(doc.get('limits', dict()), pb.limits)
    PolicyMimeTypeRules.convert_doc_to_pb(doc.get('mime_type_rules', list()), pb.mime_type_rules)
    PolicyProxyRules.convert_doc_to_pb(doc.get('proxy_rules', list()), pb.proxy_rules)
    PolicyRobotsTxt.convert_doc_to_pb(doc.get('robots_txt', dict()), pb.robots_txt)
    PolicyUrlNormalization.convert_doc_to_pb(doc.get('url_normalization', dict()), pb.url_normalization)
    PolicyUrlRules.convert_doc_to_pb(doc.get('url_rules', list()), pb.url_rules)
    PolicyUserAgents.convert_doc_to_pb(doc.get('user_agents', list()), pb.user_agents)