def import_from_text(
    httpreq: Request, request: ImportTextRequest
) -> BulkObservableAddResponse:
    """Adds and returns an observable for a given string, attempting to guess
    its type."""
    try:
        observables, unknown = observable.save_from_text(
            text=request.text, tags=request.tags
        )

    except ValueError as error:
        raise HTTPException(status_code=400, detail=str(error))

    for obs in observables:
        audit.log_timeline(httpreq.state.username, obs, action="import-text")
        rbac.set_acls(obs, user=httpreq.state.user)
    return BulkObservableAddResponse(added=observables, failed=unknown)
Adds and returns an observable for a given string, attempting to guess
    its type.
core/web/apiv2/observables.py