@staticmethod
def convert_pb_to_doc(pb):
    '\n        Convert protobuf to database document.\n\n        :param pb: A protobuf\n        :type pb: starbelly.starbelly_pb2.Policy.\n        :returns: Database document.\n        :rtype: dict\n        '
    doc = {'name': pb.name, 'authentication': dict(), 'limits': dict(), 'mime_type_rules': list(), 'proxy_rules': list(), 'robots_txt': dict(), 'url_normalization': dict(), 'url_rules': list(), 'user_agents': list()}
    if pb.HasField('policy_id'):
        doc['id'] = str(UUID(bytes=pb.policy_id))
    if pb.HasField('created_at'):
        doc['created_at'] = dateutil.parser.parse(pb.created_at)
    if pb.HasField('updated_at'):
        doc['updated_at'] = dateutil.parser.parse(pb.updated_at)
    PolicyAuthentication.convert_pb_to_doc(pb.authentication, doc['authentication'])
    if pb.HasField('captcha_solver_id'):
        doc['captcha_solver_id'] = str(UUID(bytes=pb.captcha_solver_id))
    else:
        doc['captcha_solver_id'] = None
    PolicyLimits.convert_pb_to_doc(pb.limits, doc['limits'])
    PolicyMimeTypeRules.convert_pb_to_doc(pb.mime_type_rules, doc['mime_type_rules'])
    PolicyProxyRules.convert_pb_to_doc(pb.proxy_rules, doc['proxy_rules'])
    PolicyRobotsTxt.convert_pb_to_doc(pb.robots_txt, doc['robots_txt'])
    PolicyUrlNormalization.convert_pb_to_doc(pb.url_normalization, doc['url_normalization'])
    PolicyUrlRules.convert_pb_to_doc(pb.url_rules, doc['url_rules'])
    PolicyUserAgents.convert_pb_to_doc(pb.user_agents, doc['user_agents'])
    return doc
Convert protobuf to database document.

:param pb: A protobuf
:type pb: starbelly.starbelly_pb2.Policy.
:returns: Database document.
:rtype: dict
@staticmethod
def convert_pb_to_doc(pb):
    '\n        Convert protobuf to database document.\n\n        :param pb: A protobuf\n        :type pb: starbelly.starbelly_pb2.Policy.\n        :returns: Database document.\n        :rtype: dict\n        '
    doc = {'name': pb.name, 'authentication': dict(), 'limits': dict(), 'mime_type_rules': list(), 'proxy_rules': list(), 'robots_txt': dict(), 'url_normalization': dict(), 'url_rules': list(), 'user_agents': list()}
    if pb.HasField('policy_id'):
        doc['id'] = str(UUID(bytes=pb.policy_id))
    if pb.HasField('created_at'):
        doc['created_at'] = dateutil.parser.parse(pb.created_at)
    if pb.HasField('updated_at'):
        doc['updated_at'] = dateutil.parser.parse(pb.updated_at)
    PolicyAuthentication.convert_pb_to_doc(pb.authentication, doc['authentication'])
    if pb.HasField('captcha_solver_id'):
        doc['captcha_solver_id'] = str(UUID(bytes=pb.captcha_solver_id))
    else:
        doc['captcha_solver_id'] = None
    PolicyLimits.convert_pb_to_doc(pb.limits, doc['limits'])
    PolicyMimeTypeRules.convert_pb_to_doc(pb.mime_type_rules, doc['mime_type_rules'])
    PolicyProxyRules.convert_pb_to_doc(pb.proxy_rules, doc['proxy_rules'])
    PolicyRobotsTxt.convert_pb_to_doc(pb.robots_txt, doc['robots_txt'])
    PolicyUrlNormalization.convert_pb_to_doc(pb.url_normalization, doc['url_normalization'])
    PolicyUrlRules.convert_pb_to_doc(pb.url_rules, doc['url_rules'])
    PolicyUserAgents.convert_pb_to_doc(pb.user_agents, doc['user_agents'])
    return doc