def parse_and_error_handle(parser, data, upload_format):
    try:
        parsed_message = parser(data)
    except (
        EMDSError, MalformedUploadError, TypeError, ValueError
    ) as exc:
        # Something bad happened. We know this will return at least a
        # semi-useful error message, so do so.
        response.status = 400
        logger.error("Error to %s: %s" % (get_remote_address(), exc.message))
        return exc.message

    ip_hash_salt = settings.GATEWAY_IP_KEY_SALT
    if ip_hash_salt:
        # If an IP hash is set, salt+hash the uploader's IP address and set
        # it as the EMDR upload key value.
        ip_hash = hashlib.sha1(ip_hash_salt + get_remote_address()).hexdigest()
        parsed_message.upload_keys.append({'name': 'EMDR', 'key': ip_hash})

    # Sends the parsed MarketOrderList or MarketHistoryList to the Announcers
    # as compressed JSON.
    gevent.spawn(order_pusher.push_message, parsed_message)

    logger.info("Accepted %s %s upload from %s" % (
        upload_format, parsed_message.list_type, get_remote_address()
    ))
    # Goofy, but apparently expected by EVE Market Data Uploader.
    return '1'
return a pymongo DBRef instance related to the document
dataset/ETHPy150Open gtaylor/EVE-Market-Data-Relay/emdr/daemons/gateway/wsgi.py/parse_and_error_handle--crossover with--dataset/ETHPy150Open namlook/mongokit/mongokit/document.py/Document.get_dbref